I have a problem with build my project on
- windows 11
- python 3.9.13
- pyinstaller 5.7.0
- wxpython 4.2.0
- cefpython 66.1
everythings are 64bit and no problem "python BuildTest.py".
it works. no error.
But... For share my program. after build as "pyinstaller BuildTest.spec".
BuildTest.exe file not working with this error message
"ERROR:icu_util.cc(133) Invalid file descriptor to ICU data received."
So I have searched on google, stackoverflow, cefpython forum and found several solutions to solve this problem.
1. replace hookspath=[ ] in my "BuilTest.spec" to
hookspath= ['.'] or hookspath=['.', 'C:\copied cefpython resource path']
2. on program root folder. replace "hook-cefpython3.py"
python2 import to is_py2 = None
3. copy cefpython all resources and paste to project root folder
4. find error while spec file build. (debug=True. i think no error)
5. find error after change cef_setting (debug=True. i think no error when spec build)
6. down-grade python 3.9 to 3.8 and again 3.7
7. use cefpython 66.0 on 3.7
8. install Microsoft SDK / Visual C++ Build tool 14, cmake
9. remove all python packages (like csv, json ...)
10. check and print all paths about cef_setting (BuildTest.py works very well)
11. reboot computer
but everythings not work i had tried.
i have no idea. how to run this cefPython program without ICU error message ??
this is my python code
BuildTest.py
from cefpython3 import cefpython as cef
#chrome_folder is my Chrome_resources folder path
cef_setting = {
"context_menu": {"enabled": False},
"multi_threaded_message_loop": False,
"browser_subprocess_path": f"{chrome_folder}\\subprocess.exe",
"resources_dir_path": chrome_folder,
"user_data_path": f"{chrome_folder}\\user_data",
"locales_dir_path": f"{chrome_folder}\\locales",
"cache_path": f"{chrome_folder}\\caches",
#korean
"locale": "ko.pak",
"command_line_args_disabled": True,
"downloads_enabled": False,
"ignore_certificate_errors": True,
"javascript_flags": "--js-flags",
"product_version": version,
"remote_debugging_port": -1,
"debug": True,
}
sys.excepthook = cef.ExceptHook
#only BuildTest.exe raise Invalid ICU message at this code
cef.Initialize(cef_setting, None)
APP().MainLoop()
BuildTest.spec file code
#-*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['BuildTest.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=['.'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='BuildTest',
debug=True,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
when run BuildTest.exe with debug mode
[8240] PyInstaller Bootloader 5.x
[8240] LOADER: executable is E:\Python\python39\BuildTest.exe
[8240] LOADER: homepath is E:\Python\python39
[8240] LOADER: _MEIPASS2 is NULL
[8240] LOADER: archivename is E:\Python\python39\BuildTest.exe
[8240] LOADER: Cookie found at offset 0x79AE927
[8240] LOADER: Extracting binaries
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402 with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402\cefpython3 with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402\pywin32_system32 with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402\wx with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402\locales with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: creating directory C:\Users\Username\AppData\Local\Temp\_MEI82402\swiftshader with security string: D:(A;;FA;;;S-1-5-21-3853376492-3040409701-2110696266-1003)
[8240] LOADER: Executing self as child
[8240] LOADER: set _MEIPASS2 to C:\Users\Username\AppData\Local\Temp\_MEI82402
[8240] LOADER: Setting up to run child
[8240] LOADER: Creating child process
[8240] LOADER: Waiting for child process to finish...
[3824] PyInstaller Bootloader 5.x
[3824] LOADER: executable is E:\Python\python39\BuildTest.exe
[3824] LOADER: homepath is E:\Python\python39
[3824] LOADER: _MEIPASS2 is C:\Users\Username\AppData\Local\Temp\_MEI82402
[3824] LOADER: archivename is E:\Python\python39\BuildTest.exe
[3824] LOADER: Cookie found at offset 0x79AE927
[3824] LOADER: SetDllDirectory(C:\Users\Username\AppData\Local\Temp\_MEI82402)
[3824] LOADER: Already in the child - running user's code.
[3824] LOADER: ucrtbase.dll found: C:\Users\Username\AppData\Local\Temp\_MEI82402\ucrtbase.dll
[3824] LOADER: Python library: C:\Users\Username\AppData\Local\Temp\_MEI82402\python39.dll
[3824] LOADER: Loaded functions from Python library.
[3824] LOADER: Manipulating environment (sys.path, sys.prefix)
[3824] LOADER: sys.prefix is C:\Users\Username\AppData\Local\Temp\_MEI82402
[3824] LOADER: Pre-init sys.path is C:\Users\Username\AppData\Local\Temp\_MEI82402\base_library.zip;C:\Users\Username\AppData\Local\Temp\_MEI82402\lib-dynload;C:\Users\Username\AppData\Local\Temp\_MEI82402
[3824] LOADER: Setting runtime options
[3824] LOADER: Initializing python
[3824] LOADER: Overriding Python's sys.path
[3824] LOADER: Post-init sys.path is C:\Users\Username\AppData\Local\Temp\_MEI82402\base_library.zip;C:\Users\Username\AppData\Local\Temp\_MEI82402\lib-dynload;C:\Users\Username\AppData\Local\Temp\_MEI82402
[3824] LOADER: Setting sys.argv
[3824] LOADER: setting sys._MEIPASS
[3824] LOADER: importing modules from CArchive
[3824] LOADER: extracted struct
[3824] LOADER: running unmarshalled code object for struct...
[3824] LOADER: extracted pyimod01_archive
[3824] LOADER: running unmarshalled code object for pyimod01_archive...
[3824] LOADER: extracted pyimod02_importers
[3824] LOADER: running unmarshalled code object for pyimod02_importers...
[3824] LOADER: extracted pyimod03_ctypes
[3824] LOADER: running unmarshalled code object for pyimod03_ctypes...
[3824] LOADER: extracted pyimod04_pywin32
[3824] LOADER: running unmarshalled code object for pyimod04_pywin32...
[3824] LOADER: Installing PYZ archive with Python modules.
[3824] LOADER: PYZ archive: PYZ-00.pyz
[3824] LOADER: Running pyiboot01_bootstrap.py
[3824] LOADER: Running pyi_rth_inspect.py
[3824] LOADER: Running BuildTest.py
[0118/211649.807:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.