From 5df94db8e0293a68b72f80f6d7d3cece8596fc92 Mon Sep 17 00:00:00 2001 From: Gael Magnan de bornier Date: Wed, 17 Apr 2024 22:38:40 -0700 Subject: [PATCH] Fix UnboundLocalError: local variable 'qbitItems' referenced before assignment Application crash at startup if QBITTORRENT_URL is not set due to logger accessing un-assigned variable, by moving this log line into the if statement it should prevent the issue. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 3e0df45..668bcf9 100644 --- a/main.py +++ b/main.py @@ -47,8 +47,8 @@ async def getProtectedAndPrivateFromQbit(settingsDict): qbitItem['is_private'] = qbitItemProperties.get('is_private', None) # Adds the is_private flag to qbitItem info for simplified logging if qbitItemProperties.get('is_private', False): privateDowloadIDs.append(str.upper(qbitItem['hash'])) + logger.debug('main/getProtectedAndPrivateFromQbit/qbitItems: %s', str([{"hash": str.upper(item["hash"]), "name": item["name"], "tags": item["tags"], "is_private": item.get("is_private", None)} for item in qbitItems])) - logger.debug('main/getProtectedAndPrivateFromQbit/qbitItems: %s', str([{"hash": str.upper(item["hash"]), "name": item["name"], "tags": item["tags"], "is_private": item.get("is_private", None)} for item in qbitItems])) logger.debug('main/getProtectedAndPrivateFromQbit/protectedDownloadIDs: %s', str(protectedDownloadIDs)) logger.debug('main/getProtectedAndPrivateFromQbit/privateDowloadIDs: %s', str(privateDowloadIDs))