说, 我在UNIX上有一个perl scipt: trial.pl
print ("hello" world);
和python在窗口上: Python文章:
subprocess.call("perl trial.pl",shell=True)
它在GUI中打印“1”表示错误,为什么?
答案 0 :(得分:2)
如果成功执行perl脚本,它将返回零
>>> rc = subprocess.call('perl /tmp/t.pl', shell=True)
Hello world
>>> rc
0
因此,如果您收到返回1,则表示perl
找不到trial.pl
文件(您需要指定修复它的绝对路径)或者您的perl脚本文件中存在问题(你可以独立运行它来验证)