pythonpyqt5qtwebengine

Displaying web page with PyQt5 WebEngine


I encountered some problems with the use of the library QtWebEngineWidgets. The main idea is to display PDF in a QWebEngineView, so I want firstly to display simply a web page like https://google.com.

I tested a lot of code from different websites and forums but I have always the same problem, the PyQt page show nothing.

I would like to get your attention to a code from codeloop (https://codeloop.org/python-how-to-make-browser-in-pyqt5-with-pyqtwebengine/)

import sys
from PyQt5.Qt import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtWidgets import QApplication

app = QApplication(sys.argv)

web = QWebEngineView()

web.load(QUrl("https://google.com"))

web.show()

sys.exit(app.exec_())

( I chose this because it's a simple code and illustrate perfectly the problem that I encounter all the time )

Code and page

I remain open to all your answers and comments.

{EDIT} I have : PyQt5 5.15.0 PyQt5-sip 12.8.0 PyQtWebEngine 5.15.0

enter image description here

(Dialog box: The application failed to start correctly)


Solution

  • Thanks to @eyllanesc, in fact the problem is with permissions. By creating a virtual environment according to the python documentation (https://docs.python.org/3/tutorial/venv.html), my program work perfectly.