From efa2c09e2e25c414bae8edc0edfb6e0175820179 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 2 Feb 2023 11:00:41 +0100 Subject: [PATCH] connection: Fix traceback on loading an invalid cookiejar file Ignore the error and overwrite the cookiejar file with new content after we get a new cookie from server. --- osc/connection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osc/connection.py b/osc/connection.py index 0b2ecfdc..a6441211 100644 --- a/osc/connection.py +++ b/osc/connection.py @@ -451,7 +451,10 @@ class CookieJarAuthHandler(AuthHandlerBase): pass jar = http.cookiejar.LWPCookieJar(self.cookiejar_path) if os.path.isfile(self.cookiejar_path): - jar.load() + try: + jar.load() + except http.cookiejar.LoadError: + pass self.COOKIEJARS[self.cookiejar_path] = jar return jar