Where does IDLE expect to find imported files?
Justin Shaw
wyojustin at hotmail.com
Wed May 22 21:12:36 EDT 2002
Python searches the $PYTHONPATH environmental variable which behaves like
the $PATH variable. Try this:
UNIX> setenv PYTHONPATH /home/caroline/python # or wherever
prog.py is
UNIX> python
...
>>> import prog
>>> prog.run() ...
To make the module available to all users put it in (on Solaris default
install) /usr/local/lib/python2.2/site-packages/
Good luck!
"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?
>
> 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?
>
> Caroline.
>
>
>
More information about the Python-list
mailing list