I used QtDesigner for designing GUI and use pyuic5 for generating python code. After freezing it with cxfreeze or py2exe, app crashes on setupUI function, which is pyuic5 generated. When running app from code, it works as it supposed to. I use python 3.4 (Within Anaconda Distribution) and Qt 5.5.1
The first piece of code that app brokes (which is on setupUI method of main UI):
#Add a QWidget to QTabWidget
self.ModuleListingWidget.addTab(self.MarketingTab, "")
When i use dependencywalker and try to profile the resulted exe it logs following errors:
00:00:00.000: Started "dist\MAIN.EXE" (process 0x2938) at address 0x000C0000. Cannot hook module.
00:00:00.000: Loaded "c:\windows\system32\NTDLL.DLL" at address 0x772C0000. Cannot hook module.
00:00:00.047: Loaded "c:\windows\syswow64\KERNEL32.DLL" at address 0x76CA0000. Cannot hook module.
00:00:00.047: Loaded "c:\windows\syswow64\KERNELBASE.DLL" at address 0x74BF0000. Cannot hook module.
...
00:00:00.125: First chance exception 0xC0000005 (Access Violation) occurred at address 0x721E5B10.
00:00:00.125: Second chance exception 0xC0000005 (Access Violation) occurred at address 0x721E5B10.
Both py2exe and cxfreeze gives same error, 0xC0000005 (Access Violation).
How can i fix this problem, or understand more about the problem itself?
Here is the cxfreeze config:
import sys
from cx_Freeze import setup, Executable
base = "Win32GUI"
path_platforms = ( ".\platforms\qwindows.dll", "platforms\qwindows.dll" )
build_options = {"packages": ['atexit'], "include_files" : [ path_platforms ]}
setup(
name = "myapp",
version = "0.1",
description = "Sample cx_Freeze script",
options = {"build_exe" : build_options},
executables = [Executable("main.py", base = base)]
)
and py2Exe config:
from distutils.core import setup
import py2exe
import sys
sys.argv.append('py2exe')
import glob
import src.MyProj
setup(console=['main.py'], options = {"py2exe": {"typelibs":
# typelib for WMI
[('{565783C6-CB41-11D1-8B02-00600806D9B6}', 0, 1, 2)],
# create a compressed zip archive
"compressed": True,
'bundle_files': 1,
"optimize": 2,
"includes":['sip', "PyQt5", 'PyQt5.QtCore', 'PyQt5.QtWidgets', 'PyQt5.QtGui', 'PyQt5.QtSql']}},
# The lib directory contains everything except the executables and the python dll.
# Can include a subdirectory name.
zipfile = "./shared.zip",
data_files=[
('Images', glob.glob('Images/*.*')),
('sqldrivers', ('C:/Users/user/src/dist/plugins/qsqlmysql.dll',)),
('/c/Python34/Lib/site-packages/PyQt5', ['C:/Python34/Lib/site-packages/PyQt5/Qt5Core.dll'])])