import sys,os
import subprocess
import pdb
pdb.set_trace()
findCMD = 'find . -name "pcapdump0"'
print os.getcwd()
print findCMD
out = subprocess.Popen(findCMD,stdout=subprocess.PIPE)
(stdout, stderr) = out.communicate()
filelist = stdout.decode().split()
print filelist
我收到此错误
Traceback (most recent call last):
File "generatepcap.py", line 10, in <module>
out = subprocess.Popen(findCMD,stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
答案 0 :(得分:2)
简单地表示它的含义:popen无法找到您指定的命令,因为您没有拆分字符串。