Skip to content

Commit

Permalink
Fix UnboundLocalError: local variable 'qbitItems' referenced before a…
Browse files Browse the repository at this point in the history
…ssignment

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.
  • Loading branch information
GaelMagnan authored Apr 18, 2024
1 parent 12a9bef commit 5df94db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 5df94db

Please sign in to comment.