1

I have written a simple app in python 3.7 using tkinter, which appears to compile fine in py2exe. When I try and run it I get the following error:

Here is the Error:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
  File "tkinter\__init__.pyc", line 36, in <module>
  File "<loader>", line 10, in <module>
  File "<loader>", line 8, in __load
ImportError: (DLL load failed: %1 is not a valid Win32 application.) 'C:\\Users\\i30103\\PycharmProjects\\emailpars\\dist\\_tkinter.pyd'

Here is the code:

from tkinter import *

# Main Program
if __name__ == '__main__':
    window = Tk()
    window.title("Welcome to LikeGeeks app")
    window.geometry('350x200')
    lbl = Label(window, text="Hello")
    lbl.grid(column=0, row=0)

    def clicked():

        lbl.configure(text="Button was clicked !!")

    btn = Button(window, text="Click Me", command=clicked)
    btn.grid(column=1, row=0)
    window.mainloop()

Here is the setup file:

from distutils.core import setup
import py2exe

setup(console=['main.py'])

Here is information about the apps and my system

I'm running a Windows 10 computer with a 64bit os.

I am running python 3.7 32bit version. "Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32"

py2exe works fine without tkinter, but I am trying to make a GUI application. Any ideas?

mjj2u2
  • 29
  • 5
  • Does this answer your question? [ImportError DLL load failed importing \_tkinter](https://stackoverflow.com/questions/8724729/importerror-dll-load-failed-importing-tkinter) – AMC Nov 09 '20 at 23:29
  • As an aside, using `import *` is generally bad practice. – AMC Nov 09 '20 at 23:30
  • Yes, I agree. This was some demo code I was working with and I haven't had time to re-write it. – mjj2u2 Nov 13 '20 at 14:22

1 Answers1

0

I tried to uninstall and reinstall Python and found that the corporate computer had python installed as part of an image and had removed the uninstall. This issue is likely caused by a custom install of python through imaging the laptop.

mjj2u2
  • 29
  • 5