开发者

py2exe executable generates log file error

开发者 https://www.devze.com 2023-04-06 17:16 出处:网络
Py2exe builds the executable without exceptions. When I run the executable, a log file is generated with the following:

Py2exe builds the executable without exceptions. When I run the executable, a log file is generated with the following:

    Traceback (most recent call last):
       File "ecm2es_gui.py", line 10, in <module>
       File "weblogin.pyo", line 4, in <module>
       File "mechanize\__init__.pyo", line 122, in <module>
       File "mechanize\_mechanize.pyo", line 14, in <module>
       File "mechanize\_html.pyo", line 19, in <module>
       File "mechanize\_form.pyo", line 64, in <module>
    ImportError: No module named inspect

When I run the program from Python Shell, Eclipse, or Geany I get no errors and it runs OK.

I thought my problem was with the installation of Mechanize or the eggs but now I don't think this is the problem.

Any ideas? TIA - Brad

UPDATE... this is my setup.py file:

    from distutils.core import setup
    import py2exe

    import sys; sys.argv.append('py2exe')

    includes = []
    excludes = ['_ssl', 'pdb', 'unittest', 'inspect',
                'pyreadline', 'difflib', 'doctest', 'locale',
                'optparse', 'pickle', 'calendar', '_gtkagg', 
                '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
                'pywin.debugger.dbgcon', 'pywin.dialogs']
    packages = []
    dll_excludes = []

    setup(
        options = {"py2exe": {"compressed": 1,
                              "optimize": 2,
                              "bundle_files": 3,
                              "includes": includes,
                              "excludes": excludes,
                              "packages": packages,
                              "dll_excludes": dll_excludes,
                              "dist_dir": "dist",
                              "xref": False,
                              "skip_archive": False,
                              "ascii": False,
                              "custom_boot_script": '',
                             }
                  },
    #    zipfile = None,开发者_JAVA技巧
        name='EnerSave Uploader',
        version='0.5',
        description='Upload ECM-1240 Data to EnerSave',
        author='Brad Norman',
        windows=[{"script":"ecm2es_gui.py", 
                  "icon_resources": [(1, "favicon.ico")]}
                ]
        )


The error is

ImportError: No module named inspect

And in your setup script you have inspect in the list of excludes. Remove it from the excludes, and py2exe will package it with your executable so mechanize can use it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号