Running "source" from python
- by R S
Hello,
I have a file a.txt with lines of commands I want to run, say:
echo 1
echo 2
echo 3
If I was on csh (unix), I would have done source a.txt and it would run.
From python I want to run os.execl with it, however I get:
>>> 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
How to do it?