Py2exe,tweepy 的运行时错误 [英] Py2exe, Runtimeerror with tweepy

查看:45
本文介绍了Py2exe,tweepy 的运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用名为 tweepy 的 twitter 的 python 插件.

I wanted to use the python plugin for twitter called tweepy.

在我的 main.py 文件中,我刚刚导入了 tweepy

in my main.py file I just imported tweepy

import tweepy

我的安装文件如下所示:

My setup-file looks like this:

from distutils.core import setup
import py2exe
setup(
    windows=[{
        "script": 'main.py',
        }],
    options={
        "py2exe": {
            "includes": ["sip", "tweepy"]
        }
    }
)

当我通过命令行执行 python setupy.py py2exe 时,我得到了这个重复的代码块,直到我得到一个 RuntimeError:相比之下,最大递归深度超出了.

When i execute python setupy.py py2exe via command line I get this repeating codeblock until I get an RuntimeError: maximum recursion depth exceeded in comparison.

File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 291, in __getattr__
    self.__finder.safe_import_hook(renamed, caller=self)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 138, in safe_import_hook
    self.import_hook(name, caller, fromlist, level)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 298, in _find_and_load
    getattr(parent_module, name.rpartition('.')[2])

有没有人知道摆脱这个循环的方法?

Does anyone knows a way to break out of this cycle?

推荐答案

好像有成为py2exe 0.9.2.2 版本中的一个错误,其中模块six.moves.urllib.parse 进入无限递归循环,直到达到最大值深度.

There seems to be a bug in the 0.9.2.2 version of py2exe where the module six.moves.urllib.parse gets into an infinite recursion loop until it reaches the maximum depth.

绕过它的一种方法是,如果您真的不需要该模块,则在您的 setup.py 中排除该模块:

One way to go around it, if you don't really need the module, is to exclude the module in your setup.py:

options={
    "py2exe": {
        "includes": ["sip", "tweepy"],
        "excludes": ["six.moves.urllib.parse"]
    }
}

这篇关于Py2exe,tweepy 的运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆