Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
Traceback (most recent call last):
File "<frozen zipimport>", line 576, in _get_decompress_func
ImportError: dlopen(/Users/jamie/Documents/Projects/python/DEBUG/dist/Timer.app/Contents/Resources/zlib.cpython-311-darwin.so, 0x0002): Library not loaded: @executable_path/../Frameworks/libz.1.3.1.dylib
Referenced from: <F5AAA9A8-54AD-34C4-89D5-5A81AD8B9B32> /Users/jamie/Documents/Projects/python/DEBUG/dist/Timer.app/Contents/Resources/zlib.cpython-311-darwin.so
Reason: tried: '/Users/jamie/Documents/Projects/python/DEBUG/dist/Timer.app/Contents/Frameworks/libz.1.3.1.dylib' (code signature invalid in <8499F826-9884-3100-AAA6-90DA9F8CB9CA> '/Users/jamie/Documents/Projects/python/DEBUG/dist/Timer.app/Contents/Frameworks/libz.1.3.1.dylib' (errno=85) sliceOffset=0x00000000, codeBlobOffset=0x00015CD0, codeBlobSize=0x00000340)
See launch_error.txt for complete error log.
Note:
If the package is built with the --alias option then the launch error does not occur
If the line import wx is removed from timer.py then the launch error does not occur
Possibly related errors in the build output:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: fatal error: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: /Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/Frameworks/libz.1.3.1.dylib
...
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/MacOS/Timer: invalid or unsupported format for signature
...
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/Frameworks/libz.1.3.1.dylib: main executable failed strict validation
...
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/MacOS/Timer: replacing existing signature
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/MacOS/Timer: invalid or unsupported format for signature
In subcomponent: /Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app/Contents/Frameworks/libz.1.3.1.dylib
...
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app: replacing existing signature
/Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app: resource fork, Finder information, or similar detritus not allowed
file with invalid attached data: Disallowed xattr com.apple.FinderInfo found on /Users/jamie/Documents/Projects/python/py2app-error/dist/Timer.app
Minimal reproducer here: https://github.com/JamesRandom/py2app-error
I build the "Timer" app with:
Then attempt to run it with:
This results in the following error messages:
See launch_error.txt for complete error log.
Note:
If the package is built with the
--alias
option then the launch error does not occurIf the line
import wx
is removed fromtimer.py
then the launch error does not occurPossibly related errors in the build output:
Version information
Hardware
Macbook Air M1 2020, 16GB memory.
OS
Python (MacPorts)
Note: Also tried using Python 3.9 with the same result.
Pip modules