M
Markus Doering
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 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: (e-mail address removed)
http://www.bgbm.org/BioDivInf/
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: (e-mail address removed)
http://www.bgbm.org/BioDivInf/