我正在尝试在OSX上运行位于here的简单Kivy应用程序。
首先,CEF在初始化期间失败。输出是:
igskcicgltgm047:Kivy_Test dslosky$ kivy cefTest4.py
[INFO ] [Logger ] Record log in /Applications/Kivy.app/Contents/Resources/.kivy/logs/kivy_15-07-09_18.txt
[INFO ] [Kivy ] v1.9.0
[INFO ] [Python ] v2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
[INFO ] [Factory ] 173 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_gif, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO ] [OSC ] using <multiprocessing> for socket
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] OpenGL version <2.1 NVIDIA-10.2.1 310.41.15f01>
[INFO ] [GL ] OpenGL vendor <NVIDIA Corporation>
[INFO ] [GL ] OpenGL renderer <NVIDIA GeForce GT 750M OpenGL Engine>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <1.20>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: sdl2
[INFO ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
[CEF Python] Initialize() called
[CEF Python] CefExecuteProcess(): exitCode = -1
[CEF Python] CefInitialize()
2015-07-09 12:20:09.283 python[4355:122290] Internals of CFAllocator not known; out-of-memory failures via CFAllocator will not result in termination. http://crbug.com/45650
[CEF Python] App_OnBeforeCommandLineProcessing_BrowserProcess()
[CEF Python] Command line string for the browser process: --browser-subprocess-path=/Applications/Kivy.app/Contents/Resources/venv/lib/python2.7/site-packages/cefpython3/subprocess --lang=en-US --log-file=debug.log --log-severity=info --enable-release-dcheck --resources-dir-path=/Applications/Kivy.app/Contents/Resources/venv/lib/python2.7/site-packages/cefpython3 --locales-dir-path=/Applications/Kivy.app/Contents/Resources/venv/lib/python2.7/site-packages/cefpython3/locales --remote-debugging-port=51420 --no-sandbox
[0709/122009:WARNING:resource_bundle.cc(269)] locale_file_path.empty()
[0709/122009:FATAL:main_delegate.cc(449)] Check failed: !loaded_locale.empty(). Locale could not be found for en-US
Trace/BPT trap: 5
我发现了一个讨论here建议手动设置local_pak
标志以避免此错误。我从第150行开始对示例代码进行了以下更改:
# Command line switches set programmatically
g_switches = {
"locale_pak": cefpython.GetModuleDirectory()
+"/Resources/en.lproj/locale.pak",
}
#init CEF
cefpython.Initialize(settings, g_switches)
这解决了我的初始化问题!出现CEF浏览器,但不会响应键盘的任何输入。我也无法使用触控板滚动,虽然我可以使用它来点击链接。
如果我通过更改locale_pak
标记走错路线,我就此问题提供了全部背景。
我正在使用:
Kivy v1.9.0
Python v2.7.6
cefpython3 v31.2
我还应该提一下,我可以运行与wxpython.py
一起打包的cefpython3
示例而不会出现问题。
非常感谢任何帮助!
答案 0 :(得分:1)
问题是在kivy_.py示例中,密钥代码专门针对Linux进行了翻译,请参阅translate_to_cef_keycode()函数:
还需要添加对Windows / OSX密钥代码的支持。