0

I am trying use py2exe to generate an executable, but when I test the executable, I get following the error message:

Traceback (most recent call last):
    File "mount_tool.py", line 15 in module <module>
    File "matplotlib\pyplot.pyo", line 98, in module <module>
    File "matplotlib\backends\__init__.pyo", line 28, in pylab_setup
    File "matplotlib\backends\backend_tkagg.pyo", line 8, in <module>
ImportError: No module named TKinter

Everything work when I am using Python code. I succeeded to generate a workable executable about six months ago with a similar code which I have now. A couple days ago, I did install the latest Python and modules to my machine. Executables that I generated after the update/installation do not work. Any ideas what could be wrong?

I fixed a little bit my code, and I getting following error message:

Traceback (most recent call last):
    File "mount_tool.py", line 15 in module <module>
    File "matplotlib\pyplot.pyo", line 98, in module <module>
    File "matplotlib\backends\__init__.pyo", line 28, in pylab_setup
    File "matplotlib\backends\backend_tkagg.pyo", line 8, in <module>
ImportError: No module named Tkinter

3 Answers3

0

Should it not be Tkinter instead of TKinter?

Also, if you installed the latest Python and modules, you may be using Python 3 now. In this case, I believe the import statement for Tkinter was changed to tkinter.

Also see ImportError when importing Tkinter in Python

Community
  • 1
  • 1
0

I have found a small error in my code, and that caused the error message. Everything works now.

-1

It looks like something is trying to import "TKinter" when the modules name is actually "Tkinter" with a lowercase "k".

Open the file "matplotlib\backends\backend_tkagg.pyo" and fix line 8 so that it imports the correct module, which is probably Tkinter or tkinter.