Import question

F

Fred Lionetti

Hi everyone,

Hopefully a quick question for someone out there--

If I have a file at C:\Python23\myfolder\mymodule.py

why can't I say (from python prompt or anywhere else):
import myfolder.mymodule ????

When I try to do that I get the following error message:
ImportError: No module named myfolder.mymodule

Yet, myfolder really is in that location, and the sys.path includes
"C:\Python23\"

If I try appending "C:\Python23\myfolder" to sys.path then I can say import
mymodule, and it works--but that creates other problems with the file I'm
working with.

Any ideas????

Thanks,
Fred
 
M

Michael Peuser

Fred Lionetti said:
If I have a file at C:\Python23\myfolder\mymodule.py

why can't I say (from python prompt or anywhere else):
import myfolder.mymodule ????

It might help to put an empty file named __init__.py into 'myfolder'
Kindly
Michael P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top