programmatically manipulation environment variables of the calling shell

Gerard Flanagan grflanagan at yahoo.co.uk
Mon Mar 12 07:13:10 EDT 2007


On Mar 12, 11:33 am, "Maxim Veksler" <hq4e... at gmail.com> wrote:
> Hello list,
>
> I'm trying to write a python script that would allow me to manipulate
> shell variables of the calling shell. I'm trying to write some logic
> that would know to add LD_LIBRARY_PATH to the users environment.
>
> In bash this is done with "export", can I do this with python? (If at
> all possible because python is actually a sub process of bash).
>

The Popen class from the subprocess module takes an optional 'env'
parameter, which defines environment variables for the child process
created by Popen, if that helps.

Gerard





More information about the Python-list mailing list