Unsolved Cache warnings on Windows 10, PyQt 5.7, after clicking url's in a QTextBrowser
-
Hello all,
I am the author of Leo, a large Python/PyQt app. I have been happily using PyQt for a long time.
The following issue only appears on Windows 10 using PyQt 5.7. There are no problems with the code on Ubuntu 16.04, and no problems anywhere with PyQt 4.x. All tests were made with Python 3.5.1.
After clicking on a URL in Leo's body pane (A QTextBrowser), the next time I start Leo the following warnings appear in the console:
[0918/053926:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5 [0918/053926:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\edreamleo\AppData\Local\python\QtWebEngine\Default\GPUCache to C:\Users\edreamleo\AppData\Local\python\QtWebEngine\Default\old_GPUCache_000 [0918/053926:ERROR:cache_creator.cc(129)] Unable to create cache [0918/053926:ERROR:shader_disk_cache.cc(589)] Shader Cache Creation failed: -2
Restarting the computer removes these warnings until I once again click on a URL.
The following python script:
from PyQt5 import QtWebEngineWidgets wep = QtWebEngineWidgets.QWebEngineProfile() print('isOffTheRecord: %s cachePath: %r' % ( wep.isOffTheRecord(), wep.cachePath()))
prints:
isOffTheRecord: True cachePath: ''
So I'm stuck. It seems there is some strange caching going on behind the scenes, but I don't have any further ideas about how to suppress the warnings.
Any ideas? Thanks.
Edward
-
I forgot to mention that the warnings appear immediately on startup, as the result of executing
sys.exit(self.qtApp.exec_())
That is, they happen as soon as exec_() is called.
-
Now I see what is going on. The warnings happen only if a version of Leo running PyQt5 is already open.
Apparently, PyQt5 is holding the Python cache open even when Leo is not active. This looks like a bug in the Windows version of PyQt5.
-
It appears that instantiating a QWebView is all that is needed to hold the cache open. It would be good to tell the QWebView not to cache anything, but I have not discovered how to do that.
-
Install Google Chrome, you can solve the problem:
[0918/053926:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5
[0918/053926:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\edreamleo\AppData\Local\python\QtWebEngine\Default\GPUCache to C:\Users\edreamleo\AppData\Local\python\QtWebEngine\Default\old_GPUCache_000
[0918/053926:ERROR:cache_creator.cc(129)] Unable to create cache
[0918/053926:ERROR:shader_disk_cache.cc(589)] Shader Cache Creation failed: -2