Date: Fri, 15 Jun 2007 11:48:31 -0400 From: "Phillip J. Eby"
At 12:50 AM 6/15/2007 -0500, Rick Ratzel wrote:
(Pdb) l 28 import xmlrpclib 29 30 import pdb 31 pdb.set_trace() 32 33 -> from enthought.traits.api import \ 34 Trait, HasTraits, Str, List, Instance, Property 35 36 from enthought.enstaller.enstaller_traits import \ 37 CreatableDir, Url 38 from enthought.enstaller.api import \
(Pdb) import enthought
(Pdb) p enthought.__path__ ('c:\\python25\\lib\\site-packages\\enstaller-2.1.0b1-py2.5-win32.egg\\enthought',)
(Pdb) s --Call--
c:\python25\lib\site-packages\enthought.traits-2.0b2.dev_r12224-py2.5-win32.egg\enthought\traits\api.py(16)<module>() -> """
Okay, so the problem here is that enthought.traits got imported *before* the __path__ was set. The __path__ needs to get set before any enthought.* imports occur.
Yes, I see now that it does get imported, but unfortunately not by my code. It's imported as a result of importing pkg_resources, since enthought.traits is a namespace package. Here's a little more detail: enstaller | - enthought.traits enstaller.gui | - enthought.traits.ui.wx And here's more pdb inspection: Z:\>python -m pdb c:\Python25\Scripts\enstaller-script.py
c:\python25\scripts\enstaller-script.py(3)<module>() -> __requires__ = 'enstaller==2.1.0b1'
(Pdb) n
c:\python25\scripts\enstaller-script.py(4)<module>() -> import sys
(Pdb) n
c:\python25\scripts\enstaller-script.py(5)<module>() -> from pkg_resources import load_entry_point
(Pdb) "enthought" in "".join(sys.modules.keys()) False (Pdb) n
c:\python25\scripts\enstaller-script.py(7)<module>() -> sys.exit(
(Pdb) "enthought" in "".join(sys.modules.keys())
True
(Pdb) [sys.modules[p] for p in sys.modules.keys() if p.startswith("enthought.")]
[
c:\python25\lib\site-packages\enstaller-2.1.0b1-py2.5-win32.egg\enthought\enst aller\session.py(33)<module>() -> from enthought.traits.api import \
(Pdb) l
28 import xmlrpclib
29
30 import pdb
31 pdb.set_trace()
32
33 -> from enthought.traits.api import \
34 Trait, HasTraits, Str, List, Instance, Property
35
36 from enthought.enstaller.enstaller_traits import \
37 CreatableDir, Url
38 from enthought.enstaller.api import \
(Pdb) [sys.modules[p] for p in sys.modules.keys() if p.startswith("enthought.tra
its")]
[]
(Pdb) for p in [(p, sys.modules[p]) for p in sys.modules.keys() if p.startswith("enthought.")] : print p
('enthought.enstaller.optparse', None)
('enthought.enstaller.re', None)
('enthought.enstaller.session',
c:\python25\lib\site-packages\enstaller-2.1.0b1-py2.5-win32.egg\enthought\traits\__init__.py(22)<module>() -> try:
(Pdb) c ------------------------------------------------------------ name | version | act | location ------------------------------------------------------------ setuptools | 0.6c6 | n | c:\python25\lib\site-packages setuptools | 0.7a1dev_r53614 | Y | c:\python25\lib\site-packages
(Pdb) p enthought.__path__ ('c:\\python25\\lib\\site-packages\\enstaller-2.1.0b1-py2.5-win32.egg\\enthought',)
(Pdb) s ImportError: 'No module named traits.api'
c:\python25\lib\site-packages\enstaller-2.1.0b1-py2.5-win32.egg\enthought\enstaller\session.py(33)<module>() -> from enthought.traits.api import \
I get a different ImportError now.
It appears that enthought.traits is not available in the enstaller egg; have you checked that?
I wish! Unfortunately it is. This is how Enstaller is able to work when no other enthought eggs are installed, or when I use setuptools 0.7. You can see the path to it in the pdb session above. Phillip, I really appreciate the time you're taking to look at this. I'm going to release a version which simply requires setuptools 0.7...unless you think that's a terrible idea, or you discover that I'm doing something wrong that I can fix. -- Rick Ratzel - Enthought, Inc. 515 Congress Avenue, Suite 2100 - Austin, Texas 78701 512-536-1057 x229 - Fax: 512-536-1059 http://www.enthought.com