cx_freeze application not working on a different computer - python

Have created an application using cx_freeze which runs with no issues on my own system but shows the error message shown in the image when the application is downloaded onto a different computer. It looks like its trying to look into my local system rather than the lib file for the modules and don't know how to change that. Have put my setup script below as well.
setup.py
import sys
from cx_Freeze import setup, Executable
includefiles = ['plankton (1).png', 'white_down_arrow.png','white_up_arrow.png','plankton150Model/', 'plankton_icon.ico']
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name="Plankton Classifier",
version="0.1",
description="Plankton Classifier",
options= {'build_exe': {'include_files':includefiles}},
executables=[Executable("original_custom_tk.py", base=base)],
)

Related

Application fails to start after building using cx_Freeze on OSX

I'm trying to build a simple app on OSX using cx_Freeze. The build using setup.py seems to go fine - it builds a .dmg and .app for my application, along with all of the source files. However, when I try to run the .app, it crashes immediately, saying "My_App quit unexpectedly". Frustratingly, I don't see any decipherable error codes I can track down.
I have stripped down the app into a very simple example. Below are my main python file and my setup file.
my_app.py
from tkinter import *
root = Tk()
root.title("Welcome to My_App")
root.geometry('350x200')
root.mainloop()
setup.py
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": [], "excludes": []}
# base="Win32GUI" should be used only for Windows GUI app
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "My_GUI",
version = "1.0",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("my_app.py", base=base)]
)
I have built an .exe on windows before, and when startup fails on windows, I at least get a traceback error message that I can track down. On OSX, it doesn't appear to do the same thing.
What's going wrong? How can I get more information on why my app is failing to start up? Below are images of my build and the error I'm getting on startup.
Ok turns out if I run the file from terminal, it outputs an actual error code. From there, I was able to track down that I did not have zlib installed. I was getting error
zipimport.ZipImportError: can't decompress data; zlib not available
What ultimately solved it for me was reading through this thread
https://github.com/jiansoung/issues-list/issues/13

error in creating executable file from python

i coded a python script in pycharm as "probe.py" and later built the executable(.exe) file out of it using the mentioned code in setup.py file but the exe file thus created shows error on opening as
import error mising required dependency['numpy'] even when it is present in my project.
error image
import sys
from cx_Freeze import setup,Executable
include_files = ['autorun.inf']
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name="Probe",version="0.1",description="fun",
options={'build_exe':{'include_files': include_files}},
executables=[Executable("probe.py",base=base)])
`
from cx_Freeze import setup, Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options = {"packages": ["numpy"],
include_files = ['autorun.inf']}
setup(
name = "Probe",
version = "0.1",
description = "fun",
options = {"build_exe": build_exe_options},
executables = [Executable("probe.py",base=base)]
)
run this script tell me if there is a problem
According to cx_Freeze documentation, try adding build_exe with a packages key.

program not working wit cx_freeze when running shortcut

I'm using cx_freeze to export a Python program. The exported program was working fine until I tried to add shortcut with icon on the desktop. I've taken the codes from there and there.
When running the main.exe file from its folder in C://Program files, there is no problem, but when I run the shortcut on the desktop there is this error :
The setup.py file :
import sys
from cx_Freeze import setup,Executable
base = None
if sys.platform == "win32":
base = "Win32GUI"
includefiles = ['bouton_ajouter_contact.png','bouton_contacts.png','bouton_deconnexion.png',\
'bouton_message.png','bouton_messages.png','bouton_reglages.png','fond_home.png','worldco.png']
includes = []
excludes = []
packages = ['os']
setup(
...
options = {'build_exe': {'includes':includes,'excludes':excludes,'packages':packages,'include_files':includefiles}},
executables = [Executable(
'main.py', base=base,
shortcutName="Messagerie Cryptee", shortcutDir="DesktopFolder",
icon='messagerie_cryptee_ico.ico'
)]
)
All the .png files and the .ico file are in the same folder as the setup.py file, in Python34. Before adding a shortcut, this problem was not there, and I don't remember having changed anything about images.
Thanks for help

Using cx_Freeze to create executable (cannot import _tkinter, DLL load failed)

I am trying to create an executable from my Python project using cx_Freeze, but keep running into this error:
Here's my setup.py:
import cx_Freeze
import os, sys
os.environ['TCL_LIBRARY'] = "D:\\Code\\Python\\3.5.2\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "D:\\Code\\Python\\3.5.2\\tcl\\tk8.6"
base = None
if sys.platform == "win32":
base = "Win32GUI"
executables = [cx_Freeze.Executable("Main.pyw", base=base)]
includes = ["tkinter"]
include_files = [r"D:\Code\Python\3.5.2\tcl\DLLs\tcl86t.dll", \
r"D:\Code\Python\3.5.2\tcl\DLLs\tk86t.dll"]
cx_Freeze.setup(
name="Test",
version = "1.0",
options={"Test.exe": {"packages":["pygame", "numpy"], "includes": includes, "include_files": include_files}},
executables = executables)
I tried putting tkinter in the "packages" list, but still get the same error. I also checked other StackOverflow posts and used parts of their setup.py code into mine, but nothing is working. I can't use PyInstaller as it doesn't support pygame and py2exe doesn't support Python 3.5. Any help would be appreciated.
Copy and Paste the files (tcl86t.dll, tk86t.dll) to the exe.win .
It worked for me.

import tkinter error

I have a .py file that I am trying to convert into an exe. I have tried numerous tries to build this file using cx_Freeze, but I keep getting the same error every time.
I've heard that it's got something to do with cx_Freeze, so I uninstalled cx_Freeze and reinstalled it using pip install cx_freezexxxx.whl wheel, but that still didn't work. I build my exe by writing python setup.py build in command line. Here's my setup .py code.
import cx_Freeze
import sys
import os
os.environ['TCL_LIBRARY'] = "C:\\Users\\louisa\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\louisa\\tcl\\tk8.6"
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("filemakergui.py", base=base, icon="Treetog-I-Documents.ico")]
cx_Freeze.setup(
name = "ALT File Maker",
options = {"build_exe": {"packages":["tkinter"], "include_files":["Treetog-I-Documents.ico", "Hopstarter-Sleek-Xp-Basic-Help.ico", "Custom-Icon-Design-Flatastic-2-Success.ico"]}},
version = "0.01",
description = "ALT File Maker",
executables = executables
)
Is there anything wrong with what I've written in my setup.py file? I've been stuck on this problem for several days now. Any tips on resolving an issue like this?

Categories

Resources