3

I'm trying to package my modules, but I can't seem to get it working.

My directory tree is something like the following:

snappy/
 __init__.py
 main/
 __init__.py
 main.py
 config.py
 ...
 ... 

and the code I'm using is

from snappy.main.config import *

I'm getting the error:

ImportError: No module named snappy.main.config

Any ideas what's going wrong? This is using Python 2.5 on Ubuntu 8.10.

Thanks in advance for your help.

rypel
4,8742 gold badges27 silver badges36 bronze badges
asked Feb 23, 2009 at 19:27

2 Answers 2

5

It depends on where your script using the import resides and your system PYTHONPATH. Basically, to have that import working you should run your script (the one having the import) in the parent directory of snappy or your script should change sys.path to include it.

./alex

answered Feb 23, 2009 at 19:31
Sign up to request clarification or add additional context in comments.

Comments

5

Is the parent directory of snappy in sys.path? If it's not, that's the only thing I can think of that would be causing your error.

answered Feb 23, 2009 at 19:29

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.