playlist list causing UnboundLocalError #5378

Closed
opened 2021-10-08 07:06:08 +02:00 by ghost · 2 comments
ghost commented 2021-10-08 07:06:08 +02:00 (Migrated from github.com)

What Red version are you using?

3.4.14

Cog name

Audio

Command name

playlist list

What did you expect to happen?

I first created an empty playlist, and then called playlist list, where I expected Red to show me the empty playlist.

What actually happened?

Red confirmed that it created the empty playlist, but reported that no playlists were found.

How can we reproduce this error?

  1. [p] playlist create playlistName
  2. [p] playlist list

Anything else?

I found an error in my log files, an UnboundLocalError as referenced in the title.
image
Additionally, here is the output of [p] debuginfo.
image

### What Red version are you using? 3.4.14 ### Cog name Audio ### Command name playlist list ### What did you expect to happen? I first created an empty playlist, and then called `playlist list`, where I expected Red to show me the empty playlist. ### What actually happened? Red confirmed that it created the empty playlist, but reported that no playlists were found. ### How can we reproduce this error? 1. `[p] playlist create playlistName` 2. `[p] playlist list` ### Anything else? I found an error in my log files, an `UnboundLocalError` as referenced in the title. ![image](https://user-images.githubusercontent.com/92138376/136501198-5cb5d5c2-140c-4931-b954-ff18af7052ec.png) Additionally, here is the output of `[p] debuginfo`. <img width="1112" alt="image" src="https://user-images.githubusercontent.com/92138376/136501321-a604d42d-e837-4bab-8bcc-4c89ba5b7cb5.png">
ghost commented 2021-10-08 08:13:57 +02:00 (Migrated from github.com)

Switching to python 3.8.12 fixed the playlist list issue

Switching to python 3.8.12 fixed the `playlist list` issue
Flame442 commented 2021-10-15 19:44:02 +02:00 (Migrated from github.com)

This UnboundLocalError appears to happen as this exception is caught and logged, execution continues without defining row_result.
github.com/Cog-Creators/Red-DiscordBot@334cd4fa2a/redbot/cogs/audio/apis/playlist_wrapper.py (L191-L197)
Note: The same UnboundLocalError will be thrown whenever ANY of the row_result = future.result() lines throw an error, as all 4 are handled the same way in that file.
EDIT: looking again, L108 and L192 are as described, but L140 and L155 are handled fine with a return.

@OlorinReborn, I would expect you to see another exception above this one which contains the text "Failed to completed playlist fetch from database". That is what is actually giving you this issue. If you can easily get that traceback as well, that information would also be helpful.

This UnboundLocalError appears to happen as this exception is caught and logged, execution continues without defining `row_result`. https://github.com/Cog-Creators/Red-DiscordBot/blob/334cd4fa2a2d89a0df87d8fa72714edb665db2a3/redbot/cogs/audio/apis/playlist_wrapper.py#L191-L197 Note: The same UnboundLocalError will be thrown whenever ANY of the `row_result = future.result()` lines throw an error, as all 4 are handled the same way in that file. EDIT: looking again, L108 and L192 are as described, but L140 and L155 are handled fine with a `return`. @OlorinReborn, I would expect you to see another exception above this one which contains the text `"Failed to completed playlist fetch from database"`. That is what is actually giving you this issue. If you can easily get that traceback as well, that information would also be helpful.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#5378
No description provided.