Import removing first module component

K

koblas

Have the following line:
import notewave.runner.LMTP

Yeilding the following error:
ImportError: No module named runner.LMTP

For the life of me I don't understand why the first component
"notewave" is being stripped off, when the import is happening.

Thanks,
 
K

koblas

Does notewave contain a _module_ named runner.LMTP ?
Probably not, since the error message says there's no
such module.

The following exist:
.../notewave/runner/LMTP.py
inside of LMTP.py there is:
class LMTPRunner(Runner) :

Another person pointed out that I should check on the __init__.py and
make sure lmtp is defined in the __all__ block. I didn't have an
__init__.py at that level of the tree, which must have been causing
problems, but clearly I don't understand the full inheritance of
__init__.py and sub-directories.
 
A

alex23

Another person pointed out that I should check on the __init__.py and
make sure lmtp is defined in the __all__ block. I didn't have an
__init__.py at that level of the tree, which must have been causing
problems, but clearly I don't understand the full inheritance of
__init__.py and sub-directories.

Heya,

If you're not sure about packages, it's covered in the python docs
here:

http://docs.python.org/tut/node8.html#SECTION008400000000000000000

An __all__ variable doesn't have to be defined, the __init__.py can be
empty, as it's the presence of that file that informs python that the
folder is a package. The example in the docs should help you here.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top