FAQ
Hello,

I just switched from 2.2 to Python 2.3.
I am developing an XML/CGI interface to databases as a python package called
"unitWrapper" containing several modules which ran fine under v2.2.

Running Python2.3 under windows2000 I get import errors when a module
imports another module of the same package with absolute package-names like
this:


main script:
"unitWrapper.wrapper" :
# import error messages and error logging mechanism
from unitWrapper.errorclasses import *
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "wrapper.py", line 67, in ?
from unitWrapper.errorclasses import *
ImportError: No module named unitWrapper.errorclasses



The module exists and curiosly the import above works fine when executed
from outside the package directory. But as soon as there is an import
statement in the imported module unitWrapper.errorclasses, trying to import
other modules in an absolute way, I get the same error again.

I checked the sys.path environment and suprisingly I found that the
site-packages directory is not included when scripts are executed from a
subfolder of site-packages:

sys.path when executing unitWrapper.wrapper.py from site-packages directoy:
['C:\\Python23\\Lib\\site-packages\\unitWrapper',
'C:\\WINNT\\System32\\python23.zip', '', 'C:\\Python23\\DLLs',
'C:\\Python23\\lib', 'C:\\Python23\\lib\\plat-win',
'C:\\Python23\\lib\\lib-tk', 'C:\\Python23']

sys.path when executing unitWrapper.wrapper.py from outside site-packages
directoy:
['C:\\Documents and Settings\\m.doering\\Desktop',
'C:\\WINNT\\System32\\python23.zip', 'C:\\Documents and
Settings\\m.doering\\Desktop', 'C:\\Python23\\DLLs', 'C:\\Python23\\lib',
'C:\\Python23\\lib\\plat-win', 'C:\\Python23\\lib\\lib-tk', 'C:\\Python23',
'C:\\Python23\\lib\\site-packages']


Is this intended ? Has there changed anything according to relative /
absolute adressing of modules ?

How should modules import other modules of the same package? Are only
relative package-names allowed?

And how do I adress a "parental" module from a subpackage in a relative way?



Any help greatly appreciated,
Markus Doering
--
Markus D?ring
Botanic Garden and Botanical Museum Berlin Dahlem,
Dept. of Biodiversit y Informatics
K?nigin-Luise-Str. 6-8, D-14191 Berlin
Email: m.doering at bgbm.org
http://www.bgbm.org/BioDivInf/

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 25, '03 at 3:56p
activeAug 26, '03 at 7:41a
posts3
users2
websitepython.org

2 users in discussion

Markus Doering: 2 posts A.M. Kuchling: 1 post

People

Translate

site design / logo © 2022 Grokbase