Default path for files

Rotwang sg552 at hotmail.co.uk
Sun Jan 24 11:33:25 EST 2010


Christian Heimes wrote:
> Rotwang wrote:
>> 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?
> 
> First of all you shouldn't alter the site module ever! The optional
> sitecustomize module exists to make global changes.
> 
> A library must never change the current working directory. It's up to
> the application to choose the right working directory. If you mess with
> the working directory in a library or global module like site you *will*
> break applications. Python has multiple ways to modify the list of
> importable locations, either globally, for the current user or the
> current application. Use them wisely!
> 
> Christian
> 

OK, thanks.



More information about the Python-list mailing list