En Sun, 24 Jan 2010 15:04:48 -0300, Günther Dietrich <gd_use...@spamfence.net> escribió:

Rotwang <sg...@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.

sitecustomize.py would be a better place. PYTHONSTARTUP is only used when running in interactive mode. Anyway, I'd do that explicitely on each script that requires it; after upgrading the Python version, or moving to another PC, those scripts would start failing...

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to