spaderdabomb
spaderdabomb

Reputation: 952

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.

enter image description here

enter image description here

Upvotes: 1

Views: 455

Answers (1)

spaderdabomb
spaderdabomb

Reputation: 952

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

Upvotes: 1

Related Questions