我写了以下2个程序,
# TempHello.py
def sayHello():
print 'Hello World !'
sayHello()
# Subprocess.py
import subprocess
if __name__ == '__main__':
print 'Calling other program'
child = subprocess.Popen( "./TempHello.py" , shell=True)
print subprocess.check_output()
print 'Calling other program completed'
当我尝试运行 Subprocess.py 程序时,它会给出以下错误,
Calling other program
./TempHello.py: 2: ./TempHello.py: Syntax error: "(" unexpected
Traceback (most recent call last):
File "/usr/mandar/AnuntaTech/eclipse_workspace/BackupManager/Subprocess.py", line 7, in <module>
print subprocess.check_output()
File "/usr/lib/python2.7/subprocess.py", line 537, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
TypeError: __init__() takes at least 2 arguments (2 given)
我无法弄清楚如何解决这个问题。请帮忙。