IDLE module path problem

Gregory William Bair gbair at steel.ucs.indiana.edu
Sun Oct 20 11:18:38 EDT 2002


GerritM <gmuller at worldonline.nl> spewed:
> "papua" <a at hotmail.com> schreef in bericht
> news:MPG.181be1164d06a0a5989680 at news.newsfeeds.com...
>> I have a python script /yyy.py/ that starts with
>>
>> from xxx import *
>>
>> where /xxx.py/ is a file in the same directory as /yyy.py/. When I start
>> this program from the MS Windows console, it runs but when I start it
>> from IDLE then /xxx.py/ is not found. What should I do?
>>
>> --
>> TIA,
>> Janos Blazi

> One way to make sure that the interpreter finds modules in its path is by
> providing .pth files in the Python main directory. In this file you put a
> single text line with the path name:
> C:/dirname/moduledir
> All pathes in pth files are added to the Python path and will be found
> irrespective of the current working directory.

> regards Gerrit

I don't use Python on my windows machine, but I know that a lot of IDEs run programs (or
scripts in this case) in either the IDE's directory or a temp directory, so your script is
all by itself.  Take the above poster's suggestion.  

I do have a question about the pth files.  When you say they are added to the Python path,
is that only effective after reboot?  Also, what is the UNIX equiv of pth files?  Just
some random questions from an inquisitive mind.

-- 
GWB
IUPUI School of Informatics
http://mypage.iu.edu/~gbair/



More information about the Python-list mailing list