[Tutor] Package problem

Dave S pythontut at pusspaws.net
Sun Aug 27 22:30:53 CEST 2006


I am having a problem with packaging. I have setup the PYTHONPATH to the core 
dir with __init__.py in the sub directories. It all worked as expected - then 
I hit a problem :(

I have a module scanDBFs in dir main with a def of getDbfData
The module I am executing is DocViewDoc in QT

DocViewDoc can import with ...
from main.scanDBFs import getDbfDir
and execute it with ...
a = getDbfData(dbf)

So I know it works ... however I prefer to
import main.scanDBFs 
and execute it with  ...
a = scanDBFs.getDbfData(dbf)
So I can see which module it comes from

However when i try the latter I get ...
  File "./DocViewDoc.py", line 80, in AuditEngine
    a = scanDBFs.getDbfData(dbf)
NameError: global name 'scanDBFs' is not defined
ubuntu at ubuntu:~/python_develop/unison/PxQxAudit/QT$

I am stuck ! - The only other thing Is that this is executed within a class, 
but that should not cause a problem.

I have tried a = main.scanDBFs.getDbfData(dbf) but keep hitting the same 
problem.

Any ideas ?

Dave


More information about the Tutor mailing list