[Tkinter] Problem with tkinter when creating .exe file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Problem with tkinter when creating .exe file (/thread-24671.html) |
Problem with tkinter when creating .exe file - Jan_97 - Feb-26-2020 I'm currently attempting to take one of my projects and turn it into a .exe file with cxfreeze. Unfortunately I've run into a problem I just cant seem to figure out, I'm hoping maybe someone can tell me what I'm doing wrong here? So here's the thing... import sys from cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need fine tuning. build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]} # GUI applications require a different base on Windows (the default is for a # console application). base = None if sys.platform == "win32": base = "Win32GUI" setup( name = "testproject1", version = "0.1", description = "My GUI application!", options = {"build_exe": build_exe_options}, executables = [Executable("Structured map.py", base=base)])This is my setup file that I use to start the whole process. Both this file and my project lies in the root venv folder which also contains the actual python installation and all modules I have ever used. I use "python setup.py" to initialize the building of the new file. Everything goes through, no issues so far... When the whole process is done I navigate to the "build" file which gets written to the venv folder and inside that folder lies the new .exe file. Here's the confusing part. When I launch it i get the following error. Traceback (most recent call last): File "C:\users\owner\desktop\untitled\venv\lib\site-packages\cx_freeze\initscripts\console.py" Line 37, in run exec(code, {__name__':'__main__}) File "Structured map.py" line 3, in <module> ModuleNotFoundError: No module named 'tkinter' Why is it not finding the tkinter module? I can run the "structured map" file just fine with tkinter imported and it will find it, I have also checked stack overflow and done quite a bit of research but can't find any solution. Any help is appreciated :) RE: Problem with tkinter when creating .exe file - buran - Feb-27-2020 (Feb-26-2020, 07:24 PM)Jan_97 Wrote: Why is it not finding the tkinter module?Are you surprised given that on line #5 you explicitly tell it to exclude tkinter? RE: Problem with tkinter when creating .exe file - Jan_97 - Feb-27-2020 Ooooof. I am so emberrased. I suppose I suffer too much from tunnel vision when I work on stuff I'm not familiar with. That was the issue. It's ok now, thank you so much. |