In PyQt5, how do you flush the cookie store to disk on application exit? [External Public Use]

Eddie Kuns Eddie.Kuns at npd.com
Sat Sep 5 21:37:49 BST 2020



Classification: External Public Use 


This email, and attachments, if any, are for the intended recipient(s), and may be shared externally and disseminated for use as permitted under applicable terms and conditions and/or terms of use.From: Florian Bruhin [mailto:me at the-compiler.org] 
> The issue went away for me with the new exit scheme, which was added (but not enabled by default) in PyQt 5.13 and became the default in PyQt 5.14.
> It looks like Eddie is using much older versions - you might want to upgrade if possible.
>
> As a workaround, here's what I did some time ago:
>    cookie = QNetworkCookie()
>    QWebEngineProfile.defaultProfile().cookieStore().deleteCookie(cookie)

That workaround works!  Thanks so much!  I'm using Anaconda to control the environment, and apparently the PyQt version there is rather out of date.  It looks like 5.9.2 is from almost 3 years ago, Wow.  Conda-forge has 5.12.3 which at least is from last year, but still too old to have the fix you mention.  I should probably at least upgrade to that version, though.  (I see that I would need to invoke QtCore.pyqt5_enable_new_onexit_scheme(True) if using 5.13.x.)

For now I've put the workaround in place with a comment indicating I want to upgrade to 5.14 or newer when I can.  I understand the workaround can't be trusted to be perfect, but so far it's immensely more successful than what I had before.  Thank you so much!  That really helps!

	Eddie





This email message and any attachments are for the sole use of the intended recipient(s).  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message and any attachments.




More information about the PyQt mailing list