【发布时间】:2014-10-28 09:45:57
【问题描述】:
我正在尝试使用子进程从 Python 解释器中调用 Python 文件“hello.py”。但我无法解决此错误。 [Python 3.4.1]。
import subprocess
subprocess.call(['hello.py', 'htmlfilename.htm'])
Traceback (most recent call last):
File "<pyshell#42>", line 1, in <module>
subprocess.call(['hello.py', 'htmlfilename.htm'])
File "C:\Python34\lib\subprocess.py", line 537, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Python34\lib\subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "C:\Python34\lib\subprocess.py", line 1111, in _execute_child
startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application
除了使用子进程之外,还有其他方法可以“调用带有参数的 python 脚本”吗?
【问题讨论】:
标签: python subprocess python-3.4