0
votes

I was trying to compile my program using py2exe with the setup.py and all but whenever I try the console gives me this:

Traceback (most recent call last):
  File "setup.py", line 10, in <module>
zipfile = None)
  File "C:\Python34\lib\distutils\core.py", line 149, in setup
dist.run_commands()
  File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
  File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
  File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 188, in run
self._run()
  File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 267, in _run
builder.analyze()
  File "C:\Python34\lib\site-packages\py2exe\runtime.py", line 164, in analyze
mf.import_hook(modname)
  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 337, in 
_find_and_load
    raise ImportError(name)
ImportError: Tkinter

I run this via the console using python.exe setup.py py2exe

The setup.py looks something like so:

from distutils.core import setup import py2exe

setup(window=[{'script': 'filename.py'}], \
            options={"py2exe": {"includes": ["decimal", "Tkinter", \
            "tkFileDialog", "csv", "xml.dom.minidom", "os"], \
            'bundle_files': 3, 'compressed': False}}, \
            zipfile = None)


excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
             "pywin.dialogs", "pywin.dialogs.list", 
             "Tkconstants","Tkinter","tcl", "_imagingtk", "PIL._imagingtk", 
             "ImageTk", "PIL.ImageTk", "FixTk"
               ]

Please help, I do not know what I am doing.

Thank you

2

2 Answers

1
votes

You are compiling with python 3. In python 3, the package is tkinter, not Tkinter

0
votes

I don't have enough reputation to add a comment, but the tkFiledialog error is similar to the Tkinter <--> tkinter error. In Python 3, you use import tkinter.filedialog as opposed to import tkFileDialog as in python 2.7