Mac OS X: Change $PATH from within python script
Posted
by
Eye of Hell
on Server Fault
See other posts from Server Fault
or by Eye of Hell
Published on 2009-07-08T20:54:10Z
Indexed on
2014/08/25
10:22 UTC
Read the original article
Hit count: 225
I have a bunch of python scripts. One of them installs software (subversion) that requires it's path to be added to $PATH. After it is installed, I want the next script to use the software. If I run export PATH=/opt/subversion/bin:$PATH
in bash between the first and second script, all is ok. But if I add os.system( 'export PATH=/opt/subversion/bin:$PATH' )
as the last command of the first script (that installs subversion), $PATH
remains unaltered after it exits.
Is it any way to change $PATH from within python script so it will remain changed after the script finishes (inside single bash session, of course, I know about /etc/profile
).
© Server Fault or respective owner