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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With