3

我的 virtualenv python 中有 zopeskel 2.21.2,它工作正常。同时,我的 Plone buildout(位于~/.buildout/eggs)中也有相同版本的 zopeskel。但是,它不起作用。运行zopeskel --list会抛出以下错误:

ImportError: cannot import name BasicNamespace

来自此链接的建议说要取出鸡蛋。我已经删除了 ~/.buildout/cache/dist/ 中的 egg 和缓存包,然后再次运行 buildout。但是,问题仍然存在。有趣的是,同一构建中的粘贴脚本正在工作。

我在 buildout.cfg 中的 zopeskel 部分如下所示:

[zopeskel]
recipe = zc.recipe.egg
eggs =
    ZopeSkel
    Paste
    PasteDeploy
    PasteScript
    zopeskel.dexterity
    ${instance:eggs}

我的构建中使用的一些包版本:

'/home/user/.buildout/eggs/Paste-1.7.5.1-py2.6.egg',
'/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg',
'/home/user/.buildout/eggs/PasteDeploy-1.3.4-py2.6.egg',
'/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg',

完整追溯:

[user@rizal myplone.site]$ ./bin/zopeskel --list
Traceback (most recent call last):
  File "./bin/zopeskel", line 346, in <module>
    import zopeskel.zopeskel_script
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
    from zopeskel.basic_namespace import BasicNamespace
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/basic_namespace.py", line 2, in <module>
    from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/vars.py", line 2, in <module>
    from paste.script.templates import var as base_var
  File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/templates.py", line 6, in <module>
    import copydir
  File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/copydir.py", line 4, in <module>
    import pkg_resources
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 700, in subscribe
    callback(dist)
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2230, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1827, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1797, in _handle_ns
    loader.load_module(packageName); module.__path__ = path
  File "/usr/lib/python2.6/pkgutil.py", line 238, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
    from zopeskel.basic_namespace import BasicNamespace
ImportError: cannot import name BasicNamespace

有什么问题?

4

1 回答 1

5

这通常发生在您在本地(构建)和全局 Python 安装中都安装了 ZopeSkel / Paster。由于管理站点包的 Python 过程失败,您最终会得到不兼容的组合。

解决方案:

http://docs.plone.org/manage/troubleshooting/exceptions.html#from-zopeskel-basic-namespace-import-basicnamespace

于 2012-07-09T15:34:46.340 回答