Where does IDLE expect to find imported files?

John Machin sjmachin at lexicon.net
Fri May 24 05:42:42 EDT 2002


"CarolineBlue" <Midnightblue3 at btinternet.com> wrote in message news:<ach90f$141$1 at knossos.btinternet.com>...
> 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?

"import prog.py" won't work. You need merely "import prog". You are
importing a module, not a file. The prog module may be found in a file
called prog.py or prog.pyc or prog.pyd or prog.pyo or prog.whatever
...

*Then* follow whatever advice you get about the Python path.



More information about the Python-list mailing list