[Zope2/Multi-Version-Eggs] Imports behaving strange
Hi, I have running Zope 2 application using SQLAlchemy 0.3.11/z3c.sqlalchemy 1.0.11 and needs to be migrated to SA 0.4/z3c.sqlalchemy 1.1. For the migration period I installed all four versions as multi-version eggs. For debugging purposes, my lib/python/Zope2/Startup/zopectl.py contains: import pkg_resources pkg_resources.require('sqlalchemy==0.4.2p3') pkg_resources.require('z3c.sqlalchemy==1.1.0') import sqlalchemy print sqlalchemy.__version__ import z3c.sqlalchemy from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper This works nicely. The correct modules are imported properly. Later during the startup phase while initializing a product called "MedienDB" the related code is doing the following import: from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper This import fails with portError: 'No module named sqlalchemy.interfaces'
/local/HRS2/Devel/ajung/HaufeCMS/lib/python/mediendb/mediendb.py(19)?() -> from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
although the same import worked much earlier? Any ideas? As said: this issue only occurs with multi-version eggs. Andreas -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting
Andreas Jung wrote at 2008-1-16 08:21 +0100:
I have running Zope 2 application using SQLAlchemy 0.3.11/z3c.sqlalchemy 1.0.11 and needs to be migrated to SA 0.4/z3c.sqlalchemy 1.1. For the migration period I installed all four versions as multi-version eggs.
For debugging purposes, my lib/python/Zope2/Startup/zopectl.py contains: .... This works nicely. The correct modules are imported properly.
Later during the startup phase while initializing a product called "MedienDB" the related code is doing the following import:
from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
This import fails with
portError: 'No module named sqlalchemy.interfaces'
/local/HRS2/Devel/ajung/HaufeCMS/lib/python/mediendb/mediendb.py(19)?() -> from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
although the same import worked much earlier?
Any ideas? As said: this issue only occurs with multi-version eggs.
Zope is *not* running in the context of "zopectl". Instead, it is running in its own process -- imports done in "zopectl" do not affect this process (Zope). You need your "pkg_require" in Zope proper (not in "zopectl"). -- Dieter
--On 16. Januar 2008 19:09:29 +0100 Dieter Maurer <dieter@handshake.de> wrote:
Andreas Jung wrote at 2008-1-16 08:21 +0100:
I have running Zope 2 application using SQLAlchemy 0.3.11/z3c.sqlalchemy 1.0.11 and needs to be migrated to SA 0.4/z3c.sqlalchemy 1.1. For the migration period I installed all four versions as multi-version eggs.
For debugging purposes, my lib/python/Zope2/Startup/zopectl.py contains: .... This works nicely. The correct modules are imported properly.
Later during the startup phase while initializing a product called "MedienDB" the related code is doing the following import:
from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
This import fails with
portError: 'No module named sqlalchemy.interfaces'
/local/HRS2/Devel/ajung/HaufeCMS/lib/python/mediendb/mediendb.py(19)?() -> from z3c.sqlalchemy.interfaces import ISQLAlchemyWrapper
although the same import worked much earlier?
Any ideas? As said: this issue only occurs with multi-version eggs.
Zope is *not* running in the context of "zopectl". Instead, it is running in its own process -- imports done in "zopectl" do not affect this process (Zope).
You need your "pkg_require" in Zope proper (not in "zopectl").
...which does not solve the problem (of *course* tried that :-)) -aj
Andreas Jung wrote at 2008-1-16 19:23 +0100:
...
You need your "pkg_require" in Zope proper (not in "zopectl").
...which does not solve the problem (of *course* tried that :-))
"pkg_require" works by fetching the distribution and putting it far ahead on "sys.path". This means, it will have no effect when the respective package has already been imported. Furthermore, later "sys.path" manipulations may partially undo the effect of a former "pkg_require". -- Dieter
participants (2)
-
Andreas Jung -
Dieter Maurer