Skip to content
This repository was archived by the owner on Jan 4, 2026. It is now read-only.

Fix speech.py issue - spamming UnboundLocalError#93

Open
nornewman wants to merge 1 commit intomatatonic:mainfrom
nornewman:patch-1
Open

Fix speech.py issue - spamming UnboundLocalError#93
nornewman wants to merge 1 commit intomatatonic:mainfrom
nornewman:patch-1

Conversation

@nornewman
Copy link
Copy Markdown

Fixed the error in speech.py that was causing the UnboundLocalError: cannot access local variable 'generator_worker' where it is not associated with a value exception.

The issue was in the cleanup function that runs as a background task after a request finishes. The function was trying to delete the variables generator_worker and out_writer_worker without checking if they exist first. This caused the error when the cleanup function executed in a scenario where these variables weren't properly initialized.

The fix adds checks to ensure these variables exist in the local scope before attempting to delete them.

Fixed the error in speech.py that was causing the UnboundLocalError: cannot access local variable 'generator_worker' where it is not associated with a value exception.

The issue was in the cleanup function that runs as a background task after a request finishes. The function was trying to delete the variables generator_worker and out_writer_worker without checking if they exist first. This caused the error when the cleanup function executed in a scenario where these variables weren't properly initialized.

The fix adds checks to ensure these variables exist in the local scope before attempting to delete them.
@matatonic
Copy link
Copy Markdown
Owner

Thanks for the report and the fix, but FYI I don't update this software much anymore and this may not get patched. Please leave the PR tho, and I'll apply it if I end up working on this again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants