Where does IDLE expect to find imported files?
Ed LeBouthillier
apendragn at earthlink.net
Fri May 24 00:32:54 EDT 2002
On Wed, 22 May 2002 23:18:39 +0000 (UTC), "CarolineBlue"
<Midnightblue3 at btinternet.com> wrote:
>BlankCan't get import to work - need to know correct directory to put
>.py files in for processing
>
>I have just installed Python 2.2.1 under Windows 98SE (from a Computer
>Shopper CD). I am working my way through the Tutorial, but cannot
>import files for processing by IDLE. Where does IDLE expect to find
>the named file (eg. prog.py), so that "import prog.py" will work?
Given file "prog.py", don't "import prog.py", but rather "import prog"
> I tried putting it various directories, such as /usr/local/bin
>/usr/local/lib /usr/local/bin/python but none have worked. SO where
>is the magic directory?
Python reads a system environment variable PYTHONPATH and
appends it to sys.path. It then searches in the directories listed
in sys.path. To make it look where you want it, add:
set PYTHONPATH=C:\directory
in your autoexec.bat file
Cheers,
Ed
More information about the Python-list
mailing list