PySide6中QWebEngineView无法加载页面的问题排查
PySide6 QWebEngineView 始终显示空白窗口问题
问题现象
QWebEngineView始终显示空白窗口,加载网页、本地HTML文件或HTML字符串均失败。
测试代码
import sys from PySide6.QtWidgets import QApplication from PySide6.QtWebEngineWidgets import QWebEngineView from PySide6.QtCore import QUrl app = QApplication(sys.argv) view = QWebEngineView() def test1(percent): print(percent) view.loadProgress.connect(test1) def test2(success): print(success) view.setUrl(QUrl("https://www.google.com")) view.show() sys.exit(app.exec())
运行输出
加载进度从0到100,但最终加载失败:
doh set to "" -- SystemOnly 0 100 False
系统环境
- Windows10
- 微软商店安装的Python3.11.6
- PySide6.6.0及更早版本
已尝试的无效方案
- 尝试类似PyQt5问题的
--no-sandbox启动参数,无效 - 添加Qt6相关DLL路径到系统PATH环境变量,无效
- 复制Qt6相关DLL到脚本目录,无效
- 用Dependency Walker检查Qt6WebEngineWidgets.dll依赖,发现api-ms-win-core-url-l1-1-0.dll等依赖文件存在于Windows文件夹中
进一步排查:监听渲染进程终止信号
添加renderProcessTerminated信号监听:
def test3(status, code): print(status, code, hex(code)) view.renderProcessTerminated.connect(test3)
输出显示渲染进程崩溃:
doh set to "" -- SystemOnly 0 RenderProcessTerminationStatus.CrashedTerminationStatus -1073741515 -0x3ffffecb RenderProcessTerminationStatus.CrashedTerminationStatus -1073741515 -0x3ffffecb 100 False
内容的提问来源于stack exchange,提问作者user22495
相关产品推荐
相关产品推荐

