473,382 Members | 1,743 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,382 software developers and data experts.

Importing of packages problem

Hi All,
I am developing a program called oop_lb.py and it's package structure is
as below:

oop_lb
|
--------------------------------------
| | |
analysis process tests

I am using the unittest module and taking a leaf out of the Xtreme
programming philosophy in as much as I am creating test modules for each
module in the program and placing them in the tests package.The analysis
and process packages contain a number of modules and I only
encounteredproblems when I started writing the modules and tests for the
analysis package.

Put simply my problem is that modules in the analysis package reference
modules in the process package and I can't seem to find a way of writing
the import statements so that the tests and oop_lb.py will both execute
without errors such as:

Traceback (most recent call last):
File "CalculateMedianTest.py", line 14, in ?
import oop_lb.analysis.CalculateMedian
File "/home/lol/disk/python/lotto/oop_lb/analysis/CalculateMedian.py",
line 13, in ?
from process import GetDraw
ImportError: No module named process

If I change the import statement so that the test works then the oop_lb.py
module will not run and gives the following message:

Traceback (most recent call last):
File "oop_lb.py", line 21, in ?
from analysis import CalculateMedian # import class definition from
file
File "/home/lol/disk/python/lotto/oop_lb/analysis/CalculateMedian.py",
line 13, in ?
from oop_lb.process import GetDraw
File "/home/lol/disk/python/lotto/oop_lb/oop_lb.py", line 21, in ?
from analysis import CalculateMedian # import class definition from
file
ImportError: cannot import name CalculateMedian

I hope I haven't been too ambiguous in my request and choice of listings
to illustrate what I mean.If you can help that would be great and if I
need to add something to make it clearer what it is I mean just let me
know.
Thanks ,Lol

--
Remove NOSPAM from my email address to use it,please.

Jul 18 '05 #1
0 1489

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

Similar topics

4
by: MK | last post by:
I'm working with IIS on W2K server. I'm trying to use module "wmi" in a CGI script but with no success. The following works: import cgitb; cgitb.enable() cgi.test() .... but the...
0
by: Axel Diener | last post by:
I embed python interpreters in a C++ program. For each script to execute I create a new interpreter. In this environment I can use the win32 extensions only one time. Here is a little piece of...
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...
12
by: qwweeeit | last post by:
The pythonic way of programming requires, as far as I know, to spread a big application in plenty of more manageable scripts, using import or from ... import to connect the various modules. In...
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: 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): ...
5
by: kyosohma | last post by:
Hi, I am trying to create a post logon script which does various tasks, like setup a printer based on location. While most of it works very fast, I have a second Python script that I run that...
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...
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: norseman | last post by:
mercado mercado wrote: ========================================================== Yes, but you may not like it. I do what you do. Prod and devel subdirs. I store the paths in a var at the top...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.