calling source command within python

Fredrik Lundh fredrik at pythonware.com
Mon Jul 21 06:16:57 EDT 2008


Jie wrote:

> i'm having trouble executing os.system('source .bashrc') command
> within python, it always says that source not found and stuff. Any
> clue?

like in

     $ python
     >>> import os
     >>> os.system("source .bashrc")
     sh: source not found and stuff
     256

?  I get

     $ python
     >>> import os
     >>> os.system("source .bashrc")
     /... stuff printed by my .bashrc file .../
     0

What happens if you do

     >>> import os
     >>> os.system("bash .bashrc")

instead?

</F>




More information about the Python-list mailing list