Change cwd in the underlying shell from Python script?

ben at co.and.co ben at co.and.co
Tue Apr 24 06:15:23 EDT 2001


Joakim Hove <hove at phys.ntnu.no> wrote:
> bash:/original/path$ myscript.py
>  
>   [The Python script goes through a "serious calculation", and finds
>    the new path "/new/path/to/where/I/want/tobe".
>  
>    When the script is finished the cwd of the underlying shell has
>    been changed to this new path.]
> 
> bash:/new/path/to/where/I/want/tobe$
> 
> Is something like this possible?

No. The cwd is a property of a process. You can change directories
anywhere you want in your Python script, but it won't influence the
parent process (bash).
 
Greetings,
-- 
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora




More information about the Python-list mailing list