Keyboard input in hello_world.py on macOS Mojave

43 views
Skip to first unread message

bier...@gmail.com

unread,
Mar 15, 2019, 9:36:23 AM3/15/19
to CEF Python
Hello,

I have problem with keyboard input in the first code example (https://github.com/cztomczak/cefpython/blob/master/examples/hello_world.py). The input goes to python terminal instead of browser.
OS: macOS Mojave 10.14.3
Python: 3.7.2 (from homebrew).
cefpython: 66.0

bier...@gmail.com

unread,
Mar 15, 2019, 9:48:55 AM3/15/19
to CEF Python
The same problem is with system python (2.7.16).

Czarek Tomczak

unread,
Mar 15, 2019, 9:49:49 AM3/15/19
to CEF Python
Have you tested other examples?
Can you test with other Python version?
Have you run other non-CEF GUI apps in Python from terminal without issues? (e.g. PyQt5)

bier...@gmail.com

unread,
Mar 15, 2019, 10:06:00 AM3/15/19
to CEF Python
PyQT5 works well (I've checked https://pythonspot.com/pyqt5-textbox-example/).

Czarek Tomczak

unread,
Mar 15, 2019, 10:21:45 AM3/15/19
to CEF Python
Please test with CEF and PyQt5. In the examples/ directory run the command:

python qt.py pyqt5

bier...@gmail.com

unread,
Mar 15, 2019, 10:33:05 AM3/15/19
to CEF Python
python qt.py pyqt5

worked

Czarek Tomczak

unread,
Mar 15, 2019, 12:09:01 PM3/15/19
to CEF Python
Can you test the hello_world.py example on another Mac machine with Mojave OS installed?

bier...@gmail.com

unread,
Mar 15, 2019, 12:21:55 PM3/15/19
to CEF Python
Currently I don't have access to other machine with Majove, but I tested it on macOS High Sierra (10.13.6) both on python 3.7.2 and on 2.7.14 - there is the same problem - the input does not go to the browser but console instead.

Czarek Tomczak

unread,
Mar 15, 2019, 1:07:58 PM3/15/19
to cefp...@googlegroups.com
Is it possible that you have some third party software installed on both machines that modifies the way your terminal behaves?

I assume since you've tested with system Python, that your Python versions are built as frameworks? That is required for GUI python apps to run without problems. See https://github.com/pyenv/pyenv/wiki#how-to-build-cpython-with-framework-support-on-os-x

The hello_world example is a barebone example and a top level window creation is handled by upstream CEF code. It's a scenario not tested in upstream, but worked in CEF Python without problems so far. Other examples in which top level window is created using a framework like PyQt5 or wxPython seem to not have this issue.

Can you test how it behaves after packaging with pyinstaller? There is an example in the examples/pyinstaller/ directory. Modify this line so that it packages "hello_world.py" instead of "wxpython.py":


Please test running packaged app from terminal using "open" command and also normally without using terminal at all to see if there are still any issues with keyboard.

bier...@gmail.com

unread,
Mar 18, 2019, 12:55:05 PM3/18/19
to CEF Python
It turned out that the problem was virtualenv. In a virtualenv, a non-framework build is used even when the environment is created from a framework build:
* https://github.com/pypa/virtualenv/issues/54
* https://github.com/pypa/virtualenv/issues/609

When I use venv from standard library everything works correctly.

Reply all
Reply to author
Forward
0 new messages