| Store | Cart

[Distutils] zc.buildout: KeyError during "buildout init" with distribute 0.6.25

From: Felix Schwarz <feli...@oss.schwarz.eu>
Fri, 06 Apr 2012 12:04:55 +0200
Hey,

I use Python 2.7 (Fedora 16). However zc.buildout (1.5.2) does not work for me:
$ buildout init
Creating '/home/fs/temp/buildout.cfg'.
Creating directory '/home/fs/temp/bin'.
Creating directory '/home/fs/temp/parts'.
Creating directory '/home/fs/temp/eggs'.
Creating directory '/home/fs/temp/develop-eggs'.
Getting distribution for 'distribute'.
Traceback (most recent call last):
...
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2230, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1815, in
declare_namespace
    path = sys.modules[parent].__path__
KeyError: 'peak'
An error occurred when trying to install distribute 0.6.25. Look above this
message for any errors that were output by easy_install.
While:
  Bootstrapping.
  Getting distribution for 'distribute'.
Error: Couldn't install: distribute 0.6.25


The code which causes the exception is:
def declare_namespace(packageName):
...
        if '.' in packageName:
            parent = '.'.join(packageName.split('.')[:-1])
            declare_namespace(parent)
            if parent not in _namespace_packages:
                __import__(parent)
            try:
                path = sys.modules[parent].__path__
            except AttributeError:
                raise TypeError("Not a package:", parent)

The package which triggers the bug is 'decoratortools' (python package
'peak.utils'). If I install other namespace packages (e.g. zope.interface)
everything works fine.

The error happens because 'peak' is not in sys.modules when buildout calls
it's easy_install implementation. If I add some code to ignore the keyerror,
everything works as expected though I'm not sure that this is the right fix.

Any idea how I can fix this? Pointers welcome.
fs
_______________________________________________
Distutils-SIG maillist  -  Dist...@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Recent Messages in this Thread
Felix Schwarz Apr 06, 2012 10:04 am
Felix Schwarz Apr 06, 2012 10:45 am
Felix Schwarz Apr 06, 2012 10:16 pm
Felix Schwarz Apr 07, 2012 11:17 am
Messages in this thread