calling source command within python

arsyed arsyed at gmail.com
Mon Jul 21 14:16:26 EDT 2008


On Mon, Jul 21, 2008 at 1:59 PM, mk <mrkafk at gmail.com> wrote:

> Jie wrote:
>
>> Hi all,
>>
>> i'm having trouble executing os.system('source .bashrc') command
>> within python, it always says that source not found and stuff. Any
>> clue?
>>
>
> It _might_ be that the shell it fires up is /bin/sh and this in turn is not
> bash.
>
> Anyway, it's better to use subprocess / Popen for this sort of operation.
>
>
>
"source" is a bash built-in command and not an executable file. That's why
you need to do something like execute "/bin/bash .bashrc".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080721/dc6643f1/attachment-0001.html>


More information about the Python-list mailing list