[Tutor] Path

Fabrizio Cellerini facelle@tiscalinet.it
Sat, 6 Jan 2001 11:57:28 +0100


I am a newbie both to Python and programming in general, so my questions
will be
trivial; I hope somebody can help.

I use Python 2.0 and Idle 0.6 on Windows 98.

My question is :

How can I setup the Python interpreter (I am not talking about Idle now !)
so that it searches for modules in a specific directory without having to
the full path in the script (e.g. using sys.path) ?

i.e. if my_module.py is in c:\my_modules and in a script I need to use
it with :

import my_module

It doesn't work,  as python doesn't search in c:\my_modules by default.

I also would like to know how to set it up so that it searches in the
current working directory too (useful if I want to move my program and
modules in a different directory).

I apologise if this is a recurrent question, but I could not find it in the
Reading the documention, I guess I have to add paths into the PYTHONPATH
variable or something : but can I do that ?

Thanks in advance.