[Pythonmac-SIG] possible OT: os.chdir on OSX

Jens Miltner jum at mac.com
Wed Mar 31 02:32:09 EST 2004


Am 31.03.2004 um 08:34 schrieb Scott Frankel:

>
> On OSX 10.3
>
> How would one change working directories using a python
> script and have the parent process (the shell from which the
> script was launched) switch to that directory?
>
> i.e.:
> os.chdir("some_other_dir")
> print os.getcwd()
>
> this prints "some_other_dir", so I know the script's process
> made it there.  But when the script exits, my shell is back to
> where I launched the script from.  (In fact, it never left.)

There's no way to ever change the working directory in the calling 
shell, since that's another process and - fortunately - one process 
can't change another process' runtime environment!

</jum>




More information about the Pythonmac-SIG mailing list