Py2exe返回RuntimeError:达到最大递归

时间:2015-09-18 14:55:47

标签: python python-2.7 recursion runtime-error py2exe

我正在尝试在Python 2.7上创建一个exe文件。我下载了py2exe版本0.6.9 win32。我得到一个RuntimeError: maximum recursion depth exceeded while calling a Python object.如果我尝试使用Pyinstaller运行它我得到错误TypeError: iteration over non-sequence,这似乎与使用py2exe的错误相同。我不确定它的来源。

我已经完成了以下步骤:创建一个setup.py文件:

from distutils.core import setup
import py2exe
setup(console=["MyFileName.py"])

然后从命令窗口运行python setup.py py2exe --help,然后python setup.py py2exe

我知道当代码遇到无限递归时会发生RunTimeError,但我的.py文件没有此错误。我试过了:

import sys
sys.setrecursionlimit(5000)

基于另一个StackOverflow答案,但我仍然得到相同的错误。 我已经包含了一个Traceback(就像我的cmd窗口将显示的那样)

    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 456, in scan_code
    self.scan_code(c, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 456, in scan_code
    self.scan_code(c, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 456, in scan_code
    self.scan_code(c, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 343, in _safe_import_h
ook
    self.import_hook(name, caller, [sub], level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 141, in import_hook
    self.ensure_fromlist(m, fromlist)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 231, in ensure_fromlis
t
    submod = self.import_module(sub, subname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 471, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 446, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 136, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 192, in find_head_pack
age
    q = self.import_module(head, qname, parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 456, in scan_code
    self.scan_code(c, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 471, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 449, in scan_code
    self._safe_import_hook(parent.__name__, None, fromlist, level=0)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 343, in _safe_import_h
ook
    self.import_hook(name, caller, [sub], level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 141, in import_hook
    self.ensure_fromlist(m, fromlist)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 231, in ensure_fromlis
t
    submod = self.import_module(sub, subname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 471, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 456, in scan_code
    self.scan_code(c, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 136, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 199, in find_head_pack
age
    q = self.import_module(head, qname, parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 471, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 343, in _safe_import_h
ook
    self.import_hook(name, caller, [sub], level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 141, in import_hook
    self.ensure_fromlist(m, fromlist)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 231, in ensure_fromlis
t
    submod = self.import_module(sub, subname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 471, in load_package
    self.load_module(fqname, fp, buf, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 314, in load_module
    self.scan_code(co, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 423, in scan_code
    self._safe_import_hook(name, m, fromlist, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 332, in _safe_import_h
ook
    self.import_hook(name, caller, level=level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 719, in import_hook
    return Base.import_hook(self,name,caller,fromlist,level)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 137, in import_hook
    m = self.load_tail(q, tail)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 214, in load_tail
    m = self.import_module(head, mname, m)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 724, in import_module
    r = Base.import_module(self,partnam,fqname,parent)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 284, in import_module
    m = self.load_module(fqname, fp, pathname, stuff)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 730, in load_module
    r = Base.load_module(self, fqname, fp, pathname, (suffix, mode, typ))
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 295, in load_module
    m = self.load_package(fqname, pathname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 463, in load_package
    m = self.add_module(fqname)
  File "C:\Anaconda\lib\site-packages\py2exe\mf.py", line 478, in add_module
    self.modules[fqname] = m = Module(fqname)
RuntimeError: maximum recursion depth exceeded while calling a Python object
在MyFileName.py中的

我导入以下模块:

import __future__    
#from __future__ import division
import itertools
from Tkinter import *
import numpy as np
from collections import OrderedDict
from bokeh.plotting import ColumnDataSource, figure, show, output_file
from bokeh.models import HoverTool
import pandas as pd
import datetime as datetime
import pandas.util.testing as tm; tm.N = 3
import pyodbc
import csv
from bokeh.charts import Bar
from bokeh.palettes import RdYlGn11
import calendar
import dateutil

0 个答案:

没有答案