chdir() problem

Grant Edwards grante at visi.com
Wed Apr 3 00:21:57 EST 2002


In article <b5b450db.0204022107.37bc0a25 at posting.google.com>, joe wrote:

> within python 2.2, chdir() works fine.
> 
> however, i want to be able to change the "active" directory, so that when
> the script completes, the user is left in a target directory (which is not
> the original directory)

Can't be done.  The chdir() call only affects the process that's running the
Python interpreter.  The current directory of parent process is unaffected.

When the script ends, that process (with the new current directory)
vanishes.  The "user's" process (the parent of the Python process) can't
have it's environment changed by the child process that's running Python.

-- 
Grant Edwards                   grante             Yow!  Is it 1974? What's
                                  at               for SUPPER? Can I spend my
                               visi.com            COLLEGE FUND in one wild
                                                   afternoon??



More information about the Python-list mailing list