wxpython gtk-3.0 debian issue

71 views
Skip to first unread message

antonis

unread,
Apr 11, 2017, 9:08:51 AM4/11/17
to CEF Python
Hello all,

I am trying to make a wx based application that uses cefpython3.

I am running the example/wxpython.py and it does run but I get two separate windows.
One with the browser running and a separate Frame from wxpython.

I am running the example under Debian testing with:
[wxpython.py] CEF Python 56.1
[wxpython.py] Python 2.7.13 64bit
[wxpython.py] wxPython 3.0.2.0 gtk2 (classic)

(tried the same versions under windows and it works as expected)

At this point I am not sure where to look for! Any ideas/recommendations on what's going on, or how can I debug it?


Here's the complete trace when I turn on the debug flag:

$ python wxpython.py
[wxpython.py] CEF Python 56.1
[wxpython.py] Python 2.7.13 64bit
[wxpython.py] wxPython 3.0.2.0 gtk2 (classic)
[CEF Python] Initialize() called
[CEF Python] CefExecuteProcess(): exitCode = -1
[CEF Python] CefInitialize()
[CEF Python] App_OnBeforeCommandLineProcessing_BrowserProcess()
[CEF Python] Command line string for the browser process: --browser-subprocess-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/subprocess --no-sandbox --lang=en-US --log-file=/home/porfyros/.virtualevns/cefpython/lib/python2.7/site-packages/cefpython3/debug.log --log-severity=error --resources-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3 --locales-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/locales --remote-debugging-port=58341
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[0411/150527.401777:ERROR:browser_main_loop.cc(272)] Gdk: /build/gtk+2.0-1aCJs4/gtk+2.0-2.24.31/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window
[CEF Python] CreateBrowserSync() called
[CEF Python] navigateUrl: https://www.google.com/
[CEF Python] CefBrowser::CreateBrowserSync()
[0411/150527.430787:ERROR:nss_util.cc(808)] After loading Root Certs, loaded==false: NSS error code: -8018
[CEF Python] GetPyBrowser(): create new PyBrowser, browserId=1
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[CEF Python] CefBrowser::CreateBrowserSync() succeeded
[CEF Python] Command line string for the zygote process: /home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/subprocess --type=zygote --no-sandbox --lang=en-US --locales-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/locales --log-file=/home/porfyros/.virtualevns/cefpython/lib/python2.7/site-packages/cefpython3/debug.log --log-severity=error --resources-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3
[wxpython.py] FocusHandler.OnGotFocus: keyboard focus fix (Issue #284)
[CEF Python] Renderer: OnContextCreated()
[CEF Python] Browser: OnProcessMessageReceived(): OnContextCreated
[CEF Python] V8ContextHandler_OnContextCreated()

Czarek Tomczak

unread,
Apr 11, 2017, 9:26:46 AM4/11/17
to CEF Python
Hi antonis,

In wxpython.py example in top comments you can see which versions were tested:

# Tested configurations:
# - wxPython 3.0 on Windows/Mac
# - wxPython 2.8 on Linux
# - CEF Python v55.4+

 From your description of the problem and from logs it seems this line is crucial:


[0411/150527.401777:ERROR:

browser_main_loop.cc(272)] Gdk: /build/gtk+2.0-1aCJs4/gtk+2.0-2.24.31/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window


It seems that window handle passed to CEF is invalid, thus CEF creates a window of its own (same effect would be when window handle was set to 0/NULL).

A call to GetHandle returns window handle:

self.browser_panel.GetHandle()

In MainFrame.__init__() you can see this code:
 
# On Linux must show before embedding browser, so that handle
# is available.
 
if LINUX:
   
self.Show()
   
self.embed_browser()
 
else:
   
self.embed_browser()
   
self.Show()

This code was required for it to work with wxPython 2.8 on Linux. Make sure you have this code in your example as well.

Try some debugging, figure out why GetHandle returns invalid window handle (possibly 0) during initial embedding of browser. This probably can be easily fixed, as it was fixed above, but you may need to do some experimentation.

Best regards.

antwnhs...@gmail.com

unread,
Apr 11, 2017, 11:01:54 AM4/11/17
to CEF Python
Hi Czarek,

Thanks for your fast reply!

I did some digging as you suggested and indeed you are right, GetHandle returns an invalid window handle.

While researching, I bumped into another thread in stackoverflow (http://stackoverflow.com/a/41424117) where it's mentioned:

"""To access the window Id (on Linux) GetHandle() used to work, it no longer does, instead you get the error in the question above. You now have to use GetId(). """

I tried therefore to change the reference of:
self.browser_panel.GetHandle() to self.browser_panel.GetId()

This is the new traceback I get:

[wxpython.py] CEF Python 56.1
[wxpython.py] Python 2.7.13 64bit
[wxpython.py] wxPython 3.0.2.0 gtk2 (classic)
[CEF Python] Initialize() called
[CEF Python] CefExecuteProcess(): exitCode = -1
[CEF Python] CefInitialize()
[CEF Python] App_OnBeforeCommandLineProcessing_BrowserProcess()

[CEF Python] Command line string for the browser process: --browser-subprocess-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/subprocess --no-sandbox --lang=en-US --log-file=/home/porfyros/.virtualevns/cefpython/lib/python2.7/site-packages/cefpython3/debug.log --log-severity=error --resources-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3 --locales-dir-path=/home/porfyros/.virtualevns/cefpython/local/lib/python2.7/site-packages/cefpython3/locales --remote-debugging-port=60813


[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()
[CEF Python] BrowserProcessHandler_OnBeforeChildProcessLaunch()

[CEF Python] ExceptHook: catched exception, will shutdown CEF now
[CEF Python] QuitMessageLoop()
[CEF Python] Shutdown()
[0411/164755.535404:ERROR:nss_util.cc(808)] After loading Root Certs, loaded==false: NSS error code: -8018
[CEF Python] CefShutdown()
[CEF Python] ExceptHook: see the catched exception below:

Traceback (most recent call last):
File "wxpython.py", line 216, in <module>
main()
File "wxpython.py", line 45, in main
app = CefApp(False)
File "wxpython.py", line 191, in __init__
super(CefApp, self).__init__(redirect=redirect)
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 8628, in __init__
self._BootstrapApp()
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 8196, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "wxpython.py", line 195, in OnInit
frame = MainFrame()
File "wxpython.py", line 93, in __init__
self.embed_browser()
File "wxpython.py", line 119, in embed_browser
[0, 0, width, height])
File "window_info.pyx", line 82, in cefpython_py27.WindowInfo.SetAsChild (cefpython_py27.cpp:40164)
OverflowError: can't convert negative value to size_t


Do you have any ideas on next steps?

Thanks in advance for your time,
-antonis


Czarek Tomczak

unread,
Apr 11, 2017, 11:54:01 AM4/11/17
to CEF Python
Looks like one of values passed to SetAsChild has a negative value (either of window handle, width or height).

antwnhs...@gmail.com

unread,
Apr 11, 2017, 11:58:17 AM4/11/17
to CEF Python
I thought so too. The GetId() returns a negative value. I change it to positive and then nothing breaks, but I have no window appearing!

Any idea?

Czarek Tomczak

unread,
Apr 11, 2017, 12:01:24 PM4/11/17
to CEF Python
You must pass a valid window handle. If you pass an invalid value expect it not to work.

Czarek Tomczak

unread,
Apr 11, 2017, 12:14:52 PM4/11/17
to CEF Python
Also from the traceback, it looks like you're not using the latest version of example from master. In my second post I made some important note about calling Show() before embedding browser - make sure you have this code in your example.

Czarek Tomczak

unread,
Apr 12, 2017, 1:22:09 AM4/12/17
to CEF Python
I've tried installing wxpython 3.0 on Linux to test it, but there are many issues when building and installing. Reported these three issues in wxpython issue tracker:

https://github.com/wxWidgets/wxPython/issues/11
https://github.com/wxWidgets/wxPython/issues/12
https://github.com/wxWidgets/wxPython/issues/13

I need wxpython 2.8 when using system Python. I only want to install wxpython 3.0 in another Python installation that I'm running using pyenv.

Czarek Tomczak

unread,
Apr 18, 2017, 3:10:35 AM4/18/17
to CEF Python
wxPython 3.0 / 4.0 issues on Linux were resolved (two separate windows). See Issue #349 for details. For wxPython 4.0 additional fixes were applied in #348, use latest example from master in github repository.


On Tuesday, April 11, 2017 at 1:08:51 PM UTC, antonis wrote:
Reply all
Reply to author
Forward
0 new messages