I've just installed Python 3.8.5 and py2exe 0.9.2.2. I have a setup.py that works with py2exe 0.6.9 on Python 2.7. When I run
setup.py py2exe
(the actual command line is
py setupexe.py py2exe
)
with the new version I get:
Traceback (most recent call last):
File "setupexe.py", line 4, in <module>
setup(name='md2html',
File "C:\Program Files\Python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\distutils_buildexe.py", line 188, in run
self._run()
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\distutils_buildexe.py", line 267, in _run
builder.analyze()
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\runtime.py", line 160, in analyze
self.mf.import_hook(modname)
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\mf3.py", line 120, in import_hook
module = self._gcd_import(name)
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\mf3.py", line 274, in _gcd_import
return self._find_and_load(name)
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\mf3.py", line 357, in _find_and_load
self._scan_code(module.__code__, module)
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\mf3.py", line 388, in _scan_code
for what, args in self._scan_opcodes(code):
File "C:\Users\Gary\AppData\Roaming\Python\Python38\site-packages\py2exe\mf3.py", line 417, in _scan_opcodes
yield "store", (names[oparg],)
IndexError: tuple index out of range
The setup.py:
from distutils.core import setup
import py2exe
from md2html import __VERSION__
setup(name='md2html',
version=__VERSION__,
author='xxxxx',
author_email='xxxxx',
description='Convert Markdown to HTML',
requires=['markdown(>=2.6.6)'],
console=['md2html.py'],
options={"py2exe":{
"excludes": [
'pyreadline', 'difflib', 'doctest', 'optparse', 'pickle', 'calendar', 'email', 'ftplib', 'httplib', 'rfc822', 'socket', 'select', 'ssl', '_ssl'] # Exclude standard library
}}
)
As I said, this worked before. My next step would be to run it in pdb, but before I jump into unfamiliar code, I thought I'd ask. Running on Windows 10. Thanks. Update: This question produces a similar error. The answer is that py2exe doesn't work with versions after Python 3.4. Disappointing! It suggests pyinstaller, which I will investigate. I really hope there's a way to make py2exe work.