Search code examples
pyqt5qt5

PyQt5 QWebEngineView blank window


I have a reasonably complex app which was working fine. Following a system upgrade from Debian 11 to 12, the QWebEngineView component shows a blank screen (just a white window). This is running inside a virtual environment managed by Poetry. All the packages inside the environment are at the latest version. Everything else in the app is working without problem.

Test case shown below. When run on a Debian 12 system with native packages installed (no venv), the test case runs just fine.

When it fails, there is no output, no errors, nothing. I'm not even sure how to go about diagnosing this.

#!/usr/bin/env python3
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtCore import QUrl

html = """
<!DOCTYPE html>
<html>
<body>
    <h1>Test</h1>
</body>
</html>
"""

app = QApplication(sys.argv)

web = QWebEngineView()

web.setHtml(html)

web.show()

sys.exit(app.exec_())

UPDATE: I've modified the body of the test case as follows:

app = QApplication(sys.argv)


def loadstart():
    print("load started")


def loadfin():
    print("load end")


def loadprog(n):
    print(f"progress {n=}")


web = QWebEngineView()

web.loadStarted.connect(loadstart)
web.loadFinished.connect(loadfin)
web.loadProgress.connect(loadprog)

In the working environment:

$ ./web.py 
load started
progress n=0
progress n=20
progress n=100
load end

In the failing environment:

$ ./web.py 
load started
progress n=0
progress n=100

So, the working environment has a signal called at 20% load which the failing environment does not; also, the failing environment does get to 100% but never calls loadFinished

Still trying to work out what's going on...


Solution

  • Answer from PyQt mailing list:

    Looks like this issue: https://bugreports.qt.io/browse/QTBUG-103969

    The 5.15.2 binary distributable doesn't work with newer glibc versions.

    The only workarounds I'm aware of is to pass --disable-seccomp-filter-sandbox as one of the args to QApplication or to use a newer WebEngine version.