Paths...

Ben Hutchings ben.hutchings at roundpoint.com
Thu Apr 5 21:39:24 EDT 2001


"Vincent A. Primavera" <vincent_a_primavera at netzero.net> writes:

> Hello,
> 	I am in the process of converting a Unix shell script into
> Python.  What can I do to set and export a path equivalent to
> PATH=:/usr/bin; export PATH?

That PATH setting doesn't seem to make sense because it begins
with a separator, but anyway the equivalent would be:

    import os
    os.environ['PATH'] = ':/usr/bin'

Python exports all environmental variables when starting a new
process, as long as your C library has a putenv() function.  (If it
doesn't, then you will need to pass the new environment explicitly to
the function that creates the new process.)

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list