Problem importing packages

A

Alban Hertroys

I'm trying to create a package containing a number of classes I made,
but I can't get it to work...

My package is structured like this:

X/
__init__.py
A.py
B.py

When I try:
python says:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ImportError: No module named X.A


As far as I can see, I do it exactly like the 'documentation' says, but
it obviously doesn't work this way. What am I missing? (clear
documentation, obviously...)

For the record, I believe my paths are right. If I do the following, I
can at least import class A:

Python version is 2.3.3 on Debian Linux.
 
A

Alban Hertroys

Alban said:
I'm trying to create a package containing a number of classes I made,
but I can't get it to work...

My package is structured like this:

X/
__init__.py

Doh! I named it __init.py__ instead...
It DOES work using __init__.py.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top