473,396 Members | 1,895 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.

Package importing problem

Hi,

I'm writing a plugin based application with python 2.1 but I really have
some trouble with creating a package. My directory structure is:
Skib/Server/Python/:
skib
skibserver

Skib/Server/Python/skib:
__init__.py
PluginManager.py
plugins

Skib/Server/Python/skib/plugins:
default
__init__.py

Skib/Server/Python/skib/plugins/default:
default.py
__init__.py

in all the __init__.py files I have the __all__=["blah","blah"]
statement. When I try it as:

from skib import PluginManager
PluginManager.init_plugins()

It works. But when I try it like that:

import skib
skib.PluginManager.init_plugins()

It raises AttributeError and complains that there is nothing called
PluginManager. Subpackages also behave like that. The __init__.py files
only contain the __all__ directive. No actual code are in them. Am I
missing a point?

Thanks.

--
Love, Respect, Linux
################################################## ##########################
Whom computers would destroy, they must first drive mad.
################################################## ##########################
Tonguç Yumruk

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/WuAo1xWu4MLSyoYRAlh+AKCJSV5XTM9ek+E6CjIN1kJmRDDUXw Cg3wGn
//5/Q80TfREQk9pjrRXBJes=
=iL4M
-----END PGP SIGNATURE-----

Jul 18 '05 #1
1 1391
Tonguç Yumruk wrote:
Hi,

I'm writing a plugin based application with python 2.1 but I really have
some trouble with creating a package. My directory structure is:
Skib/Server/Python/:
skib
skibserver

Skib/Server/Python/skib:
__init__.py
PluginManager.py
plugins

Skib/Server/Python/skib/plugins:
default
__init__.py

Skib/Server/Python/skib/plugins/default:
default.py
__init__.py

in all the __init__.py files I have the __all__=["blah","blah"]
statement. When I try it as:

from skib import PluginManager
PluginManager.init_plugins()

It works. But when I try it like that:

import skib
skib.PluginManager.init_plugins()

It raises AttributeError and complains that there is nothing called
PluginManager. Subpackages also behave like that. The __init__.py files
only contain the __all__ directive. No actual code are in them. Am I
missing a point?

Thanks.


I think that is because skib/PluginManager.py was never imported. Putting

import PluginManager

into skib/__init__.py should do (just a guess, though).

Peter
Jul 18 '05 #2

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

Similar topics

4
by: Robert Ferrell | last post by:
I have a question about how to organize modules in a package. I think there is something fundamental that I am missing. Say I'm creating a package, GreatPackage, which has three sub-packages,...
2
by: Dave | last post by:
Hi Everyone, I am trying to import a package and then loop through the modules inside the package, but I'm running to a problem. Basically: ----- I have a package called...
0
by: Mark English | last post by:
Basic problem: If there is a C-extension module in a package and it tries to import another python module in the same package without using the fully qualified path, the import fails. Config:...
4
by: flupke | last post by:
Hi, I developed a package with a structure like this src/ tesfile.py dir1/ __init__.py file1.py dir2/ __init__.py
4
by: Mike | last post by:
Hello, I'm currently working on debugging a very large DTS package that was created by someone else for the purpose of importing data into my company's database. The data is mainly...
1
by: Leo | last post by:
Hello all, I am having a problem which I cannot seem to find a solution for. In SQL Server 2000 I have created a DTS package which imports a Text file into a table. When I run the DTS package...
11
by: fortepianissimo | last post by:
Say I have the following package organization in a system I'm developing: A |----B |----C |----D I have a module, say 'foo', that both package D and B require. What is the best practice in...
14
by: amitsoni.1984 | last post by:
hi, I have some values(say from -a to a) stored in a vector and I want to plot a histogram for those values. How can I get it done in python. I have installed and imported the Matplotlib package...
0
by: fboweb.com | last post by:
Hey there! I have a DTS import package from an old SQL server that takes flat text files, does some munging on the columns using ActiveX scripts and imports those flat files to various tables. ...
1
by: mypetslug | last post by:
Hi, I'm sorry if this has been asked before, but I can't seem to find an answer to this anywhere and so far, trial and error hasn't gotten me far either. Using python 2.4, I've created a...
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.