473,418 Members | 2,079 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,418 software developers and data experts.

Python2.3 absolute import error

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.*******@bgbm.org
http://www.bgbm.org/BioDivInf/
Jul 18 '05 #1
2 6388
On Mon, 25 Aug 2003 17:56:52 +0200,
'import site' failed; use -v for traceback

^^^^ what's this?

I expect the installation is incorrect or sys.path is messed up in some way,
and suspect that your import problems are only a side effect, not the root
cause of the problem. Run "python -v" to see the traceback from site.py.

--amk
Jul 18 '05 #2
Oh man.
After diving into the site.py traceback I noticed that I had a module named
"types" in my package and site.py tried to import the standard types module
but ended up importing my custom module instead (the scripts directory is
the first in sys.path).
I renamed it and everything seems to work fine.

Thanks,
Markus

"A.M. Kuchling" <am*@amk.ca> wrote in message
news:g8********************@speakeasy.net...
On Mon, 25 Aug 2003 17:56:52 +0200,
'import site' failed; use -v for traceback ^^^^ what's this?

I expect the installation is incorrect or sys.path is messed up in some

way, and suspect that your import problems are only a side effect, not the root
cause of the problem. Run "python -v" to see the traceback from site.py.

--amk

Jul 18 '05 #3

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

Similar topics

2
by: Jakub Moscicki | last post by:
Hello, A small problem: I get a signal during a system call (from xmlrpclib -> httplib) and an exception "IOError: Interrupted system call" is raised (this is system dependant, on other machine...
0
by: johan | last post by:
---------- Forwarded Message ---------- Subject: problem CMFOODocument Date: Tuesday 21 October 2003 11:18 From: johan <johan30@easynet.be> To: zope@zope.org Hi, I have the following...
3
by: Adil Hasan | last post by:
Hello, I'm having problems trying to use ZSI to connect to a https url. I give the command and I get prompted for my X509 cert pass-phrase, but the program dies with an openssl error. Here's my...
1
by: Jeremy C. Reed | last post by:
Configuring gramps (genealogy software) says: checking Python bindings for gtk... ok checking Python bindings for GNOME... ok checking Python bindings for gconf... Traceback (most recent call...
2
by: venkatbo | last post by:
Hi all, I have python2.4 running on ppc-linux 2.6.17. I'm attempting to get a TurboGears 0.9a9 (using CherryPy 2.2.1) based app running on it. During the TG-app startup sequence, it reaches...
15
by: Christopher Taylor | last post by:
RHEL comes with Python2.3 installed. A program I need to install requires Python2.4 So I got Python2.4 from source and compiled it up. I configured it with --prefix=/usr --exec-prefix=/usr...
6
by: samn | last post by:
i compiled and installed the release version of python 2.5 for linux to a directory accessible to 2 computers, configured with --prefix=/usr/arch (which is accessible to both machines). the...
2
by: Pradnyesh Sawant | last post by:
Hello, I have a code snippet which does 'import xmltramp' to parse an xml file received over the network. Also, I have 2 instances of python, namely python2.4 and python2.5 on my box. The...
1
by: Terry Reedy | last post by:
"Praveena B" <praveena_python@yahoo.comwrote in message news:808793.504.qm@web44809.mail.sp1.yahoo.com... when i used paramiko in python2.5 i got the error below. File "C:\praveena\python...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.