[Tutor] Newbie question
Alan Gauld
alan.gauld at btinternet.com
Tue Jul 1 18:41:08 CEST 2008
"asdg asdg" <mishu_yim at yahoo.com> wrote
> You need to add the folder containing this module to your
> PYTHONPATH.
Being picky you want to add it to your sys.path value
Python loads sys.path from the values in PYTHONPATH which is
an OS environment variable. Modifying PYTHONPATH after you
start Python will have no effect on the current session. PYTHONPATH
changes will only affect the next session you start.
> To do this, go to you interpreter and type:
>>>> import sys
>>>> sys.path.append("C:\Python25\ExampleFolder")
The snag with this is you need to do it every time you want to use
swampy. To make it apply in every session then you need to add it to
PYTHONPATH.
> Python imports it's modules from specific folders on your
> hard-drive.
> These folders where Python looks in are contained in a list.
> sys.path is actually the list containing those path names.
> Appending new path names to sys.path makes python look
> in those locations too when importing modules.
And Python automatically appends any folders it finds in
PYTHONPATH when it starts up.
HTH,
Alan G
More information about the Tutor
mailing list