0

I am trying to create a windows executable (.exe) with python3.7.6 cx_freeze. I have removed my username and python script name from the following code.

#!/usr/bin/env python3

import sys, os
from cx_Freeze import setup, Executable


PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ["TCL_LIBRARY"] = os.path.join(PYTHON_INSTALL_DIR, r"tcl", r"tcl8.6")
os.environ["TK_LIBRARY"] = os.path.join(PYTHON_INSTALL_DIR, r"tcl", r"tk8.6")

#includes = []
include_files = [r'C:\Users\<username>\AppData\Local\Programs\Python\Python37\DLLs\tcl86t.dll', 
r'C:\Users\<username>\AppData\Local\Programs\Python\Python37\DLLs\tk86t.dll']

build_options = {"packages": ["os","pandas","numpy","openpyxl","re","sys","easygui","pyexcel", 
"string", "utils","tkinter", 
r'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python37\\lib\\tkinter'],"includes": 
[r'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python37\\lib\\tkinter'], 'include_files': 
include_files}

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(name="Extract from <script_name>",version="1.0",options ={'build_exe': 
build_options},description="Extracts information from <script_name>",executables= 
[Executable("<script_name>", base = base)])

I am prompted with these errors after building:

enter image description here

The setup.py script is based on:

cx_freeze Tkinter 'Module not Found'

When using cx_Freeze and tkinter I get: "DLL load failed: The specified module could not be found." (Python 3.5.3)

How to include tkinter when using cx_freeze to convert script to .exe?

Using EasyGui With Cx_Freeze

I have tried building with/without specifying the modules both in includes/package options, providing tkinter .dll files, and tkinter absolute package path.

I also checked the cx_freeze documentation:

https://cx-freeze.readthedocs.io/en/latest/index.html

In the frequently asked questions, it mentions the following:

"Modules that your code imports are detected, but if they’re dynamically loaded - e.g. by a plugin system - you have to tell cx_Freeze about them."

If this is the case and cause of the issue, how would I go about identifying dynamically loaded packages?

Any help in resolving this would be appreciated.

Thanks again,

enzsio

ENZSIO
  • 183
  • 3
  • 11

1 Answers1

0

Just stumbled on the answer by accident. After building using the following command:

python3 setup.py build

I was poking around the lib folders in the build. The tkinter library (directory) was named Tkinter (capatilized 'T'). I changed directories name to 'tkinter' and ran the executable. Program started up perfectly.

I want to say thank you to those who viewed this thread and were going to attempt to answer.

Thanks again!
enzsio

ENZSIO
  • 183
  • 3
  • 11