Importing of packages problem

R

Rogue 9

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
 

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

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top