473,796 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.p y
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","bla h"]
statement. When I try it as:

from skib import PluginManager
PluginManager.i nit_plugins()

It works. But when I try it like that:

import skib
skib.PluginMana ger.init_plugin s()

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/WuAo1xWu4MLSyoY RAlh+AKCJSV5XTM 9ek+E6CjIN1kJmR DDUXwCg3wGn
//5/Q80TfREQk9pjrRX BJes=
=iL4M
-----END PGP SIGNATURE-----

Jul 18 '05 #1
1 1404
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.p y
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","bla h"]
statement. When I try it as:

from skib import PluginManager
PluginManager.i nit_plugins()

It works. But when I try it like that:

import skib
skib.PluginMana ger.init_plugin s()

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.p y 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
4203
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, myUtilities, GoodStuff, MoreGoodStuff. The directories look like: GreatPackage |
2
3834
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 regression.changepassword.unittests which contains test modules. --- In a test agent module (called agent.a), I do the following:
0
1375
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: Python 2.4 on Windows 2000 For example: mypackage contains:
4
1559
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
6103
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 user/contact-related data for our customer base. We ran into problems when one import, of about 40,000 rows, took upwards of six hours to complete. Many of the stored procedures used by this package were written using XML. I've re-written many of them
1
1202
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 from the SQL sever itself it executes without any isses. However it is failing without any error codes when I try to run it from ASP.NET. There seems to be no solution to this so far that I have found. I would greatly appreaciate it if anyone has...
11
3866
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 terms of creating a 'common' package that hosts
14
6756
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 but on executing the code =hist(eig, 10) # make a histogram I am getting an error saying "NameError: name 'hist' is not defined". Is there any other way to plot histograms over a given range?
0
1724
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. The package itself is rather tedious because it does this munging on a number of large files with a number of different fields. When I bring the package in via SSIS, importing/migrating the
1
1544
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 testing application. When the app starts up, I do a from tests import * and it looks at the /tests directory and loads up all the tests it finds at that time. This works fine when interpreting the python code directly. The problem I'm having is...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10461
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.