首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OrderedDict错误,无法导入Funnelweb

OrderedDict错误,无法导入Funnelweb
EN

Stack Overflow用户
提问于 2013-01-16 20:10:34
回答 1查看 14.7K关注 0票数 7

我正在尝试从一个网站导入一些静态页面使用plone的funnelweb附加组件。下面是我写的:bin/funnelweb --crawler:url=http://wiki.scandiatransplant.com --crawler:max=50 --ploneupload=http://admin:admin@localhost:8080/TestPage

我得到了这个错误:

代码语言:javascript
复制
ImportError: cannot import name OrderedDict

下面添加了完整的回溯。有人知道怎么解决这个问题吗?

代码语言:javascript
复制
Traceback (most recent call last):
  File "bin/funnelweb", line 116, in <module>
    mr.migrator.runner.runner({},"funnelweb.remote")
  File "/home/magiq/Plone/buildout-cache/eggs/mr.migrator-1.0.1-py2.6.egg/mr/migrator/runner/__init__.py", line 69, in runner
    load_config('autoinclude.zcml', mr.migrator)
  File "/home/magiq/Plone/buildout-cache/eggs/Zope2-2.13.12-py2.6.egg/Zope2/App/zcml.py", line 55, in load_config
    _context = xmlconfig.file(config, package, _context, execute=execute)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 649, in file
    include(context, name, package)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 548, in include
    processxmlfile(f, context)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 380, in processxmlfile
    parser.parse(src)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 359, in endElementNS
    self.context.end()
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 558, in end
    self.stack.pop().finish()
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 706, in finish
    actions = self.handler(context, **args)
  File "/home/magiq/Plone/buildout-cache/eggs/z3c.autoinclude-0.3.4-py2.6.egg/z3c/autoinclude/zcml.py", line 104, in includePluginsDirective
    includeZCMLGroup(_context, info, filename)
  File "/home/magiq/Plone/buildout-cache/eggs/z3c.autoinclude-0.3.4-py2.6.egg/z3c/autoinclude/zcml.py", line 30, in includeZCMLGroup
    include(_context, filename, includable_package)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 548, in include
    processxmlfile(f, context)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 380, in processxmlfile
    parser.parse(src)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/home/magiq/Plone/Python-2.6/lib/python2.6/xml/sax/expatreader.py", line 349, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 359, in endElementNS
    self.context.end()
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 558, in end
    self.stack.pop().finish()
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 705, in finish
    args = toargs(context, *self.argdata)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 1397, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/fields.py", line 137, in fromUnicode
    value = self.context.resolve(name)
  File "/home/magiq/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 179, in resolve
    mod = __import__(mname, *_import_chickens)
  File "/home/magiq/Plone/buildout-cache/eggs/transmogrify.webcrawler-1.2.1-py2.6.egg/transmogrify/webcrawler/webcrawler.py", line 21, in <module>
    from collections import OrderedDict
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/magiq/Plone/buildout-cache/eggs/mr.migrator-1.0.1-py2.6.egg/mr/migrator/autoinclude.zcml", line 10.4-10.85
    ZopeXMLConfigurationError: File "/home/magiq/Plone/buildout-cache/eggs/transmogrify.webcrawler-1.2.1-py2.6.egg/transmogrify/webcrawler/configure.zcml", line 9.4-10.46
    ImportError: cannot import name OrderedDict
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-16 20:23:49

OrderedDict是Python2.7中添加的一个新类,因此在您的示例中缺少它。

您可以安装backport

代码语言:javascript
复制
pip install ordereddict

或者将其作为依赖项添加到构建中,然后编辑Plone/buildout-cache/eggs/transmogrify.webcrawler-1.2.1-py2.6.egg/transmogrify/webcrawler/webcrawler.py第21行以更改导入:

代码语言:javascript
复制
from collections import OrderedDict

代码语言:javascript
复制
try:
    from collections import OrderedDict
except ImportError:
    # python 2.6 or earlier, use backport
    from ordereddict import OrderedDict

我已经在funnelweb issue tracker中提交了一个问题,请求将其添加到该包的未来版本中,请参阅issue 22

票数 26
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14358162

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档