idle import problem
Matthew Wilson
mwilson at sarcastic-horse.com
Tue Sep 23 15:03:01 EDT 2003
More information about the Python-list mailing list
Tue Sep 23 15:03:01 EDT 2003
- Previous message (by thread): idle import problem
- Next message (by thread): idle import problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks - That's really useful. I know how to set PYTHONPATH in unix, but how to in windows? > On Tuesday 23 Sep 2003 5:43 pm, Matthew Wilson wrote: >> Hi- >> >> I'm trying to import a countylist.py file in idle, and it isn't working. >> What am I doing wrong? >> >> >>> os.listdir(os.getcwd()) >> >> ['4dcountylist.txt', 'CBP90KY_TXT.htm', 'CBP90OH_TXT.htm', >> 'CBP90PA_TXT.htm', 'CBP90WV_TXT.htm', 'countylist.py', 'geocode.txt', >> 'mvsales.xls', 'mvsalesbyfirm.xls', 'production_in_4d.xls', >> 'USSalesSummary0308-1.xls'] >> >> >>> import countylist >> >> Traceback (most recent call last): >> File "<pyshell#15>", line 1, in -toplevel- >> import countylist >> ImportError: No module named countylist >> >> >> Any ideas? > > > Python doesn't import from the current directory; it uses sys.path, unless > the > cwd is on sys.path... > > if you want to temporarily put it on the path, do: > > import os,sys > sys.path.append(os.getcwd()) > > but a better solution is to either put your module into a directory tha > *is* > on sys.path, or modify your python path setting directlty by setting your > environment var PYTHONPATH accordingly. > > hope that helps > -andyj >
- Previous message (by thread): idle import problem
- Next message (by thread): idle import problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list