子进程调用proses错误

时间:2016-05-23 13:50:06

标签: python python-2.7 subprocess

我尝试编程imalse,以下是这样的python脚本:

**#!/usr/bin/env python
"""
This is shortcut command to run simulate.py in ns3 ./waf shell
"""
import settings
import sys
import subprocess
cmd = settings.ROOT + '/simulate.py ' + ' '.join(sys.argv[1:])
# print cmd
waf_cmd = ['cd', settings.NS3_PATH, '&&', './waf', '--pyrun', '"%s"'%(cmd)]
# subprocess.check_call(['cd', settings.NS3_PATH, '&&', './waf', '--pyrun', '"%s"'%(cmd)])
print '--> %s'%(' '.join(waf_cmd))
subprocess.check_call(' '.join(waf_cmd), shell=True)**

和那样的错误:

Command ['/usr/bin/python', '/home/kelompok6/new/imalse/simulate.py'] exited with code 1
Traceback (most recent call last):
  File "./sim", line 16, in <module>
    subprocess.check_call(' '.join(waf_cmd), shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cd /home/kelompok6/new/ns-allinone-3.14.1-with-imalse/ns-3.14.1 && ./waf --pyrun "/home/kelompok6/new/imalse/simulate.py "' returned non-zero exit status 1
kelompok6@kelompok6:~/new/imalse$ clear

我该怎么办?

0 个答案:

没有答案