【发布时间】:2016-02-01 01:23:06
【问题描述】:
我想从 python 脚本中运行另一个 python 脚本,并终止原始脚本。我尝试了以下方法:
import os
import os.path
print os.getcwd()
>>>home/pi/Gen
print os.path.exists('/home/pi/Gen/Binary2.py')
>>> True
os.execl('python', '/home/pi/Gen/Binary2.py')
>>> OSError: [Errno 2] No such file or directory
我做错了什么?
【问题讨论】:
-
Python 在你的道路上吗?
-
execfile(path_to_other_script)