im making my first steps in python. I made a usefull code using many libraries and now i'm trying to make it .exe with py2exe.
This exe should open an interfase made with tkinter, where you upload some csv files and the it printes in a PDF (using pdfkit)
This is my setup.py
# -*- coding: utf-8 -*-
import sys
from distutils.core import setup
includes = ['tkinter', 'shutil', 'os', 're', 'pandas', 'jinja2', 'io', 'pdfkit', 'base64', 'numpy', 'matplotlib', 'distutils']
opts = {
'console' : [{
'script' : 'interfase.py',
'description' : 'Descripcion del programa.',
'icon_resources' : [(0, 'myicon.ico')]
}],
'zipfile' : None,
'options' : { 'py2exe' : {
'includes': includes,
'dll_excludes' : ['w9xpopen.exe'],
'bundle_files' : 1,
'compressed' : True,
'optimize' : 2
}},
}
setup(
options = opts
)
and I get this Traceback
Traceback (most recent call last):
File "setup.py", line 30, in <module>
options = opts
File "C:\Users\Screspo\Anaconda3\lib\distutils\core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "C:\Users\Screspo\Anaconda3\lib\site-packages\py2exe\patch_distutils.py", line 81, in __init__
distutils.dist.Distribution.__init__(self, attrs)
File "C:\Users\Screspo\Anaconda3\lib\distutils\dist.py", line 251, in __init__
for (opt, val) in cmd_options.items():
AttributeError: 'list' object has no attribute 'items'
ANY clue of what might be missing?
Thanks in advance!
You need to remove the first brackets [] after 'console'.
'console' : {
'script' : 'interfase.py',
'description' : 'Descripcion del programa.',
'icon_resources' : [(0, 'myicon.ico')]
},
If you have the error "AttributeError: 'NoneType' object has no attribute 'items'", you need to remove this line
'zipfile': None,