2

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)

  • What version of pyqt5 and pyqtwebengine do you have installed? you could run your script from CMD/console – eyllanesc Jul 26 '20 at 15:56
  • did u consider the dialogue boxes? the code works fine. may be some problem with the istallation – Adhun Thalekkara Jul 26 '20 at 16:05
  • Thank for your answer @eyllanesc, I edited my post with the versions. I found an error when I launch the program: I put a screenshot in my post. edit: you talk about a dialog box like in my screenshot ? – Fabien Denoyelle Jul 26 '20 at 16:06
  • @FabienDenoyelle I don't understand the error message, can you translate to english? Also try install pyqt5 pyqtwebengine older: `python -m pip install pyqt5==5.14.0 pyqtwebengine==5.14.0` – eyllanesc Jul 26 '20 at 16:10
  • It had no influence, I still have the same error message. – Fabien Denoyelle Jul 26 '20 at 16:18
  • `[14216:4056:0726/183251.559:ERROR:cache_util_win.cc(21)] Unable to move the cache: AccÞs refusÚ. (0x5) (((--> access denied ))) [14216:4056:0726/183251.560:ERROR:cache_util.cc(141)] Unable to move cache folder C:\Users\denoy\AppData\Local\python3\QtWebEngine\Default\GPUCache to C:\Users\denoy\AppData\Local\python3\QtWebEngine\Default\old_GPUCache_000 [14216:4056:0726/183251.560:ERROR:disk_cache.cc(178)] Unable to create cache` It is in my console when I launch the code. – Fabien Denoyelle Jul 26 '20 at 16:35
  • @FabienDenoyelle the problem for what are the permissions, try creating a virtualenv and there install pyqt5 and pyqtwebengine. Please use `@username` – eyllanesc Jul 26 '20 at 17:38
  • Ok thank @eyllanesc, I tried with Administrator mod of the cmd without success. I never work on virtual environments. I will therefore document myself. – Fabien Denoyelle Jul 26 '20 at 18:05

1 Answers1

1

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.

Gunther Struyf
  • 11,158
  • 2
  • 34
  • 58