Here is my setup.py file for cx_Freeze
import sys
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\tcl\tk8.6"
build_exe_options = {"packages":["os"], "includes" : ["tkinter"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name='APS West Email Generator',
version='1.0',
description='Auto generates Alarm notification emails. And maybe more in the future.',
options = {"build_exe": build_exe_options},
executables = [Executable("Tool_EmailGenerator.py", base=base)])
The executable is made with no errors. But when I try to run it I get the following window:
title: cx_Freeze: Python error in main script
contents: Traceback(most recent call last): file "c:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freeze\initscripts__startup__.py",line12,in import(name+ "init") file "c:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cx_Freeze\initscripts\Console.py",line 21, in scriptModule=import(moduleName) File "Tool_EmailGenerator.py", line 2, in File "c:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\tkinter__init__.py", line 35, in import_tkinter #if this fails your python may not be configured for Tk ImportError: DLL load failed: The specified module could not be found.
tkinter works when I run the py file pre-cx_Freeze. I've searched the internet and tried various suggestions. nothings worked so far. I'm not sure whats causing this.