The two executables likely used different PyInstaller versions or different build options (--onefile vs --onedir).
To understand the error, you first need to know how PyInstaller packages Python scripts into standalone executables. Then attempt to parse TOC (table of contents)
def find_pyinstaller_cookie(data): # Look for cookie signature near end of file # PyInstaller cookie format: 8 bytes magic (MEI\0\0\0\0 or similar) # plus version and struct length cookie_magic = b'MEI\0\0\0\0' # older versions alternatives = [b'MEI', b'PYZ', b'\x33\x0F'] # heuristicsfor offset in range(len(data) - 100, max(0, len(data) - 5000), -4): if data[offset:offset+4] in alternatives: return offset return None
Then attempt to parse TOC (table of contents) even if version mismatch, by brute-force scanning for PYZ entry points. len(data) - 5000)