Hi ho
I'm developping Trac plugins for our internal management needs, and
experiment some rather strange import problems with plugins having
sub-packages. Everything works fine as long as I'm testing (ie deploying
with "setup.py develop --multi-version
--install-dir=$TRAC_ENV/plugins", but as soon as I build real eggs and
mv them to $TRAC_ENV/plugins, importing from sub-packages doesn't work
anymore (ImportError...).
(NB : running Trac with Python 2.4.x, Apache2/mod_python)
I've tried with both relative and absolute imports, without result (both
relative and absolute import works fine in dev mode). And I find really
strange things in the traceback, like references to PIL __init__ (no, my
plugin doesn't rely on PIL).
Here's a relevant part of the traceback in the log:
"""
2006-10-26 16:13:45,254 Trac[__init__] ERROR: Failed to load plugin
TracMdxcontact from
/var/lib/trac/modulix.local/plugins/TracMdxcontact-0.1-py2.4.egg
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/loader.py", line 94, in
load_components
entry_point.load()
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1830,
in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "build/bdist.linux-x86_64/egg/mdxcontact/__init__.py", line 3, in ?
# $Id: __init__.py 2134 2004-10-06 08:55:20Z fredrik $
File "build/bdist.linux-x86_64/egg/mdxcontact/controllers.py", line
17, in ?
ImportError: No module named views.contact
"""
Notice the "# $Id: __init__.py 2134 2004-10-06 08:55:20Z fredrik $" line
that comes from PIL __init__
The offending like in mdxcontact/controllers looks like this:
"""
from mdxcontact.views.contact import \
ContactGrid, ContactEditForm, ContactViewForm
#from views.contact import ContactGrid, ContactEditForm, ContactViewForm
"""
Using relative imports yields the exact same result. I've googled a bit
for eggs + sub packages, but didn't find anything enlightning.
Please someone give me a hint ?
TIA
PS : I have not much experience with setuptools, so I may have
overlooked something obvious in the doc ?
PS2: I made my setup.py according to the EggCookingTutorial...
--
bruno desthuilliers
développeur
[EMAIL PROTECTED]
http://www.modulix.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/trac-dev
-~----------~----~----~----~------~----~------~--~---