0
我要開POPEN一個腳本,用sysargv的說法是這樣的:的Python POPEN sysargv
import subprocess
Script = '/home/Network_Monitor_Device/Scripts/Traceroute.py 192.168.76.1'
p = subprocess.Popen(['python','-u',Script], stdout = subprocess.PIPE, stderr=subprocess.STDOUT)
out = p.stdout.readline()
print out
Traceroute.py
import os
import sys
import subprocess
subprocess.check_output("traceroute " + str(sys.argv[1]), shell=True)
我得到這個錯誤:
python: can't open file '/home/Network_Monitor_Device/Scripts/Traceroute.py 192.168.76.1': [Errno 2] No such file or directory
當我嘗試,我得到這個錯誤:'TypeError:execv()arg 2只能包含字符串' – Manariba
這樣做!謝謝! – Manariba