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()
# Tested configurations:
# - wxPython 3.0 on Windows/Mac
# - wxPython 2.8 on Linux
# - CEF Python v55.4+
[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
self.browser_panel.GetHandle()
# 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()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
Any idea?