Jason
Jason

Reputation: 11

QtWebEngine Causing Segmentation Fault on MacOS with PyQT. What is going wrong?

I built a basic app to test QtWebEngine functionality on MacOS because my larger more complex app isn't working with WebEngine either. Both apps (the complex one, and this one), work on Windows.

Code:

import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QApplication
# use the QtWebEngineWidgets
from PyQt5.QtWebEngineWidgets import *
# start my_app
my_app = QApplication(sys.argv)
# open webpage
my_web = QWebEngineView()
my_web.load(QUrl("http://www.google.com"))
my_web.show()
# sys exit function
sys.exit(my_app.exec())

Result:

Screenshot of bug

As you can see, nothing gets rendered. It's not a blank web page, it's just that the widget does not render.

MacOS Mojave 10.14.3, PyQT5 5.14.0, PyQTWebEngine 5.14.0

I installed PyQT5 and PyQTWebEngine via Pip on MacOS. What should I do?

Edit:

I have updated to try out some debugging with signals, the code is here:

import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QApplication
# use the QtWebEngineWidgets
from PyQt5.QtWebEngineWidgets import *
# start my_app
my_app = QApplication(sys.argv)
# open webpage

def load_started():
    print("Load started")

def load_finished(x):
    print("Load finished", x)

def load_started():
    print("Load started")

def load_progress(x):
    print("Load progress: ", x)

try:
    my_web = QWebEngineView()
    my_web.load(QUrl("http://www.google.com"))
    my_web.show()
    my_web.loadStarted.connect(load_started)
    my_web.loadProgress.connect(lambda x: load_progress(x))
    my_web.loadFinished.connect(lambda x: load_finished(x))


except Exception as e:
    print(e)
# sys exit function
sys.exit(my_app.exec())

The result in the working Windows machine is

Load progress:  10
Load started
Load progress:  21
Load progress:  29
Load progress:  60
Load progress:  100
Load finished True
Load progress:  100
Load progress:  100

The result in the non-working MacOS is:

Load started
Load progress:  0
Load progress:  100

Note how it never emits the "load finished" signal

Edit 2: There happens to be a "renderProcessTerminated" signal. This signal is emitting terminationStatus = 2 (The render process crashed, for example because of a segmentation fault.) And exit code = 11 (seems to mean segmentation fault, but not sure)

So now the question is.. what is causing this crash and error?

Upvotes: 0

Views: 1088

Answers (1)

Jason
Jason

Reputation: 11

Nothing worked, tried a bunch of different install configs, new environments via venv, conda, updated MacOS to Catalina (latest version), etc.

Conclusion: 5.14 is broken. Downgraded everything to 5.12 and it worked. Took way too long but least I learned a bunch about Python environments.

Upvotes: 1

Related Questions