Default path for files

Günther Dietrich gd_usenet at spamfence.net
Sun Jan 24 13:04:48 EST 2010


Rotwang <sg552 at hotmail.co.uk> wrote:

>> Check out http://docs.python.org/library/os.html and the function
>> chdir it is what you are looking for.
>
>Thank you. So would adding
>
>import os
>os.chdir(<path>)
>
>to site.py (or any other module which is automatically imported during 
>initialisation) change the default location to <path> every time I used 
>Python?

Don't change the library modules. It would catch you anytime when you 
expect it least.

See for the environment variable PYTHONSTARTUP and the associated 
startup file.



Best regards,

Günther



More information about the Python-list mailing list