我有一个文件a.txt
,其中包含要运行的命令行,例如:
echo 1
echo 2
echo 3
如果我在 csh (unix) 上,我会完成source a.txt
并且它会运行。我想从 python 运行os.execl
它,但是我得到:
>>> os.execl("source", "a.txt")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/os.py", line 322, in execl
execv(file, args)
OSError: [Errno 2] No such file or directory
怎么做?