newbie - How do I import automatically?

Steve M sjmaster at gmail.com
Wed Nov 16 19:08:30 EST 2005


The file C:\Python24\Lib\sitecustomize.py (which I think doesn't exist
by default) executes every time Python starts. (This means not just
your IDLE session but every time you run any Python script.)

One use for this file is to invoke sys.setdefaultencoding because that
name gets deleted during initialization and so is unavailable by the
time your main script starts executing.

You can also put in any other code, such as "from btools import *".

You can also put your btools.py file in C:\Python24\Lib\site-packages
folder and it will be available from any program (as opposed to
requiring it in the current directory).




More information about the Python-list mailing list