Deploy cef-python app with py2exe

261 views
Skip to first unread message

juha.m...@gmail.com

unread,
Nov 7, 2017, 6:38:26 AM11/7/17
to CEF Python
Hello everybody!

I get CEF-python to work in my windows machine and I can run examples successfully. Anyway I don't know what is the best way to deploy a CEF in Windows systems? I tried to use py2exe. It creates a executable with about 20 other files. When I try to run this executable I get error:

C:\c\tools\cefpython\cefpython\examples\test\dist>hello_world.exe
Traceback (most recent call last):
File "hello_world.py", line 4, in <module>
File "c:\python34\lib\site-packages\cefpython3\__init__.py", line 53, in <module>
from . import cefpython_py34 as cefpython
File "<loader>", line 10, in <module>
File "<loader>", line 8, in __load
ImportError: (No module named 'json') 'C:\\c\\tools\\cefpython\\cefpython\\examples\\test\\dist\\cefpython3.cefpython_py34.pyd'


My directory contains the following files:
17.10.2017 09.39 22 720 api-ms-win-crt-convert-l1-1-0.dll
17.10.2017 09.39 19 136 api-ms-win-crt-heap-l1-1-0.dll
17.10.2017 09.39 27 840 api-ms-win-crt-math-l1-1-0.dll
17.10.2017 09.39 23 232 api-ms-win-crt-runtime-l1-1-0.dll
23.10.2017 11.19 1 315 328 cefpython3.cefpython_py27.pyd
23.10.2017 11.19 1 307 136 cefpython3.cefpython_py34.pyd
23.10.2017 11.19 1 305 088 cefpython3.cefpython_py35.pyd
23.10.2017 11.19 1 326 592 cefpython3.cefpython_py36.pyd
23.10.2017 11.19 434 176 chrome_elf.dll
23.10.2017 11.57 3 347 761 hello_world.exe
23.10.2017 11.19 67 109 376 libcef.dll
30.03.2012 11.15 569 664 MSVCP90.dll
19.02.2011 00.40 773 968 MSVCR100.dll
30.03.2012 11.15 652 608 MSVCR90.dll
16.03.2014 19.24 134 144 pyexpat.pyd
23.10.2017 11.57 2 733 056 python34.dll
16.03.2014 19.24 9 728 select.pyd
16.03.2014 19.24 758 784 unicodedata.pyd
16.03.2014 19.24 53 760 _bz2.pyd
16.03.2014 19.24 84 992 _ctypes.pyd
16.03.2014 19.25 780 288 _hashlib.pyd
16.03.2014 19.24 137 216 _lzma.pyd
16.03.2014 19.24 47 104 _socket.pyd
16.03.2014 19.25 1 203 200 _ssl.pyd

Czarek Tomczak

unread,
Nov 7, 2017, 7:53:25 AM11/7/17
to CEF Python
The "json" package is a hidden import of cefpython. You need to add this dependency, either through py2exe config or by just adding "import json" in your app.

There is an official PyInstaller example that works out of the box:
https://github.com/cztomczak/cefpython/blob/master/examples/pyinstaller/README-pyinstaller.md#pyinstaller-example

juha.m...@gmail.com

unread,
Nov 7, 2017, 8:36:42 AM11/7/17
to CEF Python
Thanks. It seemed to work. But now I get the following error:

C:\c\tools\cefpython\cefpython\examples\test\dist>hello_world.exe

[hello_world.py] CEF Python 57.1
[hello_world.py] Python 3.4.0 32bit
[1107/150221.984:ERROR:icu_util.cc(173)] Invalid file descriptor to ICU data received.

Czarek Tomczak

unread,
Nov 7, 2017, 9:23:23 AM11/7/17
to CEF Python
You are missing cef/cefpython binary files. These are files with extensions like .dll .bin .dat .pak (including locales/ subdirectory) that are in the cefpython3 package directory.
Reply all
Reply to author
Forward
0 new messages