AttributeError when importing cefpython3 with stock example setup.py and app script

340 views
Skip to first unread message

kwl...@gmail.com

unread,
Sep 25, 2018, 2:22:38 PM9/25/18
to CEF Python
I'm using a slightly modified setup.py from the example given in this issue:

https://github.com/cztomczak/cefpython/issues/337

here is my setup.py and script (test.py):

https://gist.github.com/phxvyper/550b2f99046a7646c6daac21da1d9027

the test.py is a stock example taken Hello World example from the cefpython3 module `examples` folder.

I get the following errors:

DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
Traceback (most recent call last):
File "test/dist/Hello World.app/Contents/Resources/__boot__.py", line 129, in <module>
_run()
File "test/dist/Hello World.app/Contents/Resources/__boot__.py", line 113, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "test/dist/Hello World.app/Contents/Resources/test.py", line 4, in <module>
from cefpython3 import cefpython as cef
File "test/dist/Hello World.app/Contents/Resources/lib/python3.7/cefpython3/__init__.py", line 62, in <module>
from . import cefpython_py37 as cefpython
File "cefpython_py37.pyx", line 161, in init cefpython_py37
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "test/dist/Hello World.app/Contents/Resources/__boot__.py", line 37, in load_module
os.path.join(pkg_dir, fullname), ('', '', imp.PKG_DIRECTORY))
File "imp.pyc", line 245, in load_module
File "imp.pyc", line 217, in load_package
File "<frozen importlib._bootstrap>", line 695, in _load
AttributeError: 'NoneType' object has no attribute 'name'

this is with a stock installation of python 3.7 and cefpython3, I couldn't find anything after a couple hours of googling - but maybe I just bad at doing that. Any idea whats going on?

Czarek Tomczak

unread,
Sep 25, 2018, 2:26:45 PM9/25/18
to CEF Python
What version of py2app are you using? Can you try packaging with Python 2.7?

kwl...@gmail.com

unread,
Sep 25, 2018, 3:01:18 PM9/25/18
to CEF Python
in 3.7 i have py2app 0.14
in 2.7 i have py2app 0.9

when running through 2.7 I get a single error:

Trace/BPT trap: 5

and then it quits.

kwl...@gmail.com

unread,
Sep 25, 2018, 3:04:39 PM9/25/18
to CEF Python
Forgive me, python 3.7's py2app is on 0.17.

I upgraded python 2.7's to 0.17 as well, only to be greeted by the same error.

Czarek Tomczak

unread,
Sep 25, 2018, 3:23:06 PM9/25/18
to CEF Python
Try asking on the py2app forums.

kwl...@gmail.com

unread,
Sep 27, 2018, 3:21:27 PM9/27/18
to CEF Python
I managed to fix the error by changing `urllib.request` in setup.py to `urllib`, but now I've got the following error from CEF Python:

[hello_world.py] CEF Python 66.0
[hello_world.py] Chromium 66.0.3359.181
[hello_world.py] CEF 3.3359.1774.gd49d25f
[hello_world.py] Python 3.7.0 64bit
[0927/121820.278764:ERROR:icu_util.cc(114)] icudtl.dat not found in bundle
[0927/121820.279882:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
Trace/BPT trap: 5

Ronald, the py2app dev, also managed to get to this point and couldn't figure out how to move forward. I've ensured that the entirety of the CEF Python whl package is present in `Contents/Resources/lib/python3.7/cefpython3` - including `icudtl.dat`. Can you shed some light on this error?

Czarek Tomczak

unread,
Sep 27, 2018, 6:30:20 PM9/27/18
to CEF Python

kwl...@gmail.com

unread,
Oct 1, 2018, 3:42:33 PM10/1/18
to CEF Python
That fixed the error with icudtl, thank you, but the application still crashes with a single error:

Trace/BPT trap: 5

The framework bundle for CEF seems to have all the dylibs that are in the whl package, so there must be another thing throwing the error? I'm not really sure where to begin debugging this.

here's the latest setup.py and test.py:

https://gist.github.com/phxvyper/26f03d4f547a8082eccbe477d7514f1f

Czarek Tomczak

unread,
Oct 2, 2018, 3:28:49 PM10/2/18
to CEF Python
Set an absolute path to framework_dir_path.

kwl...@gmail.com

unread,
Oct 3, 2018, 3:47:48 AM10/3/18
to CEF Python
I updated test.py yet again, using an abs path instead of a relative one. When running the app, the window appears with no content other than the window title set to "Hello World!". I get the following erroneous output in console:

[1003/004346.817441:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process.

DevTools listening on ws://127.0.0.1:63302/devtools/browser/b5faad95-ee59-4c38-8101-f92664003168
[1003/004347.337785:ERROR:service_manager_context.cc(258)] Attempting to run unsupported native service: /Users/Administrator/Documents/Projects/pakk/pakkager/test/dist/Hello World.app/Contents/Resources/lib/python3.7/cefpython3/Chromium Embedded Framework.framework/content_renderer.service

The updated test.py and setup.py:

https://gist.github.com/phxvyper/26f03d4f547a8082eccbe477d7514f1f

Running the script independently works fine with no errors. Am I missing something in my setup.py?

Czarek Tomczak

unread,
Oct 3, 2018, 4:05:48 AM10/3/18
to CEF Python
Make sure you are including all CEF binary files. It seems you are missing the subprocess executable. If you have it in a different location then set ApplicationSettings.browser_subprocess_path. Always use absolute paths.

kwl...@gmail.com

unread,
Oct 3, 2018, 4:22:01 AM10/3/18
to CEF Python
The executable was with the rest of the lib. Setting the browser_subprocess_path seems to have worked, and the example app is working. Thanks a ton <3
Reply all
Reply to author
Forward
0 new messages