473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem importing packages

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:
import X.A
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:
import sys
sys.path.append('X')
import A


Python version is 2.3.3 on Debian Linux.
Jul 18 '05 #1
1 1442
Alban Hertroys wrote:
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.
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wil Koenen | last post by:
Hi, When importing (parts of) gtk, here's what I get: >>> import gobject Traceback (most recent call last): File "<pyshell#13>", line 1, in ? import gobject ImportError: DLL load failed:...
1
by: Justin Stockton | last post by:
I recently upgraded from ActivePython 2.2.2 to ActivePython 2.3.2 and I'm running into an issue importing the win32com.client module. Before installing the new version, I made sure to properly...
4
by: Active8 | last post by:
I did this once and can't remember how <blush> so I read the reportlab user guid. It says to unzip the reportlab archive - this is on w2k, BTW, with Python23 - to a directory and make a file...
1
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
1
by: aznach | last post by:
Hello! I have a shared hosting account at GrokThis.net and have a problem with the module order of the Python search path. I'd like to use django's svn trunk instead of the...
1
by: Toby | last post by:
Hi, I've managed to get my hands on the ms 2003 toolkit, and have successfully (i think) created a .pyd file in win xp (setup.py is provided intersystems cache): ...
0
by: Martin P. Hellwig | last post by:
Hello all, I had some troubles in the past how to arrange my packages and modules, because I usually don't develop my stuff in the Lib\site-packages directory I have some troubles when importing...
4
kaarthikeyapreyan
by: kaarthikeyapreyan | last post by:
I have installed pygame v 1.8.0 The installation was sucessful, but the optional packages were not included like the font,movie etc When i was trying to run the sample script that was given it...
3
by: Chanman | last post by:
This is probably a simple question to most of you, but here goes. I've downloaded the xlrd (version 0.6.1) module and placed in in the site-packages folder. Now, when I write a script, I type: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.