PyQt5 WebEngineView If it has cookies, it crashes
-
Every time I start the app, it creates cache and cookies folders, but if I close the application and open it again, it loads the cookies and after about 5 seconds it crashes and closes without errors in the log, until then I have a code that forces it to delete the cookies and cache folders. But it's not what I wanted, I wanted the user to be able to keep cookies without any problems.
Deleting cookies and cache:
try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage'))) except: pass
Construction of web engine view:
self.browser = QWebEngineView()
Creating all deleted folders...
........profile = QWebEngineProfile("my_profile", self.browser) profile.defaultProfile().setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies) profile.defaultProfile().setCachePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache')) profile.defaultProfile().setPersistentStoragePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage')) profile.defaultProfile().setDownloadPath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Downloads')) profile.setCachePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache')) profile.setPersistentStoragePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage')) profile.setDownloadPath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Downloads')) webpage = QWebEnginePage(profile, self.browser) webpage.settings().setAttribute(QWebEngineSettings.PlaybackRequiresUserGesture, True) self.show()
" profile.defaultProfile().setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies) " I tried setting this value to ForcePersistentCookies or removing it, it didn't change anything.
-
After all, I configured everything wrong, disregard my code above, i have posted in this Topic the solution.
-
Every time I start the app, it creates cache and cookies folders, but if I close the application and open it again, it loads the cookies and after about 5 seconds it crashes and closes without errors in the log, until then I have a code that forces it to delete the cookies and cache folders. But it's not what I wanted, I wanted the user to be able to keep cookies without any problems.
Deleting cookies and cache:
try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache'))) except: pass try: if os.path.exists(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage')): shutil.rmtree((str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage'))) except: pass
Construction of web engine view:
self.browser = QWebEngineView()
Creating all deleted folders...
........profile = QWebEngineProfile("my_profile", self.browser) profile.defaultProfile().setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies) profile.defaultProfile().setCachePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropCache')) profile.defaultProfile().setPersistentStoragePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\DropStorage')) profile.defaultProfile().setDownloadPath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Downloads')) profile.setCachePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Cache')) profile.setPersistentStoragePath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Documents\WebWidget\Storage')) profile.setDownloadPath(str(str(os.path.expanduser(os.getenv('USERPROFILE'))) + r'\Downloads')) webpage = QWebEnginePage(profile, self.browser) webpage.settings().setAttribute(QWebEngineSettings.PlaybackRequiresUserGesture, True) self.show()
" profile.defaultProfile().setPersistentCookiesPolicy(QWebEngineProfile.NoPersistentCookies) " I tried setting this value to ForcePersistentCookies or removing it, it didn't change anything.
@Suundumused said in PyQt5 WebEngineView If it has cookies, it crashes:
without errors in the log
Run through debugger to see what happens
-
@Suundumused said in PyQt5 WebEngineView If it has cookies, it crashes:
without errors in the log
Run through debugger to see what happens
[2300:4272:0126/102900.323:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5 [2300:4272:0126/102900.323:ERROR:cache_util.cc(134)] Unable to move cache folder [2300:4272:0126/102900.323:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2 Release of profile requested but WebEnginePage still not deleted. Expect troubles !
-
[2300:4272:0126/102900.323:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5 [2300:4272:0126/102900.323:ERROR:cache_util.cc(134)] Unable to move cache folder [2300:4272:0126/102900.323:ERROR:shader_disk_cache.cc(606)] Shader Cache Creation failed: -2 Release of profile requested but WebEnginePage still not deleted. Expect troubles !
@Suundumused
I would suggest this will be a chromium issue. If you Google for, say,ERROR:cache_util_win.cc
you will find quite a few posts to look through matching your error messages. -
@Suundumused
I would suggest this will be a chromium issue. If you Google for, say,ERROR:cache_util_win.cc
you will find quite a few posts to look through matching your error messages.@JonB I used Jupyter in debug, it just returned unknown crash error in the log, ): I'm using Version: 5.15.9, Could a downgrade fix it?
-
After all, I configured everything wrong, disregard my code above, i have posted in this Topic the solution.
-