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
Open
Fix speech.py issue - spamming UnboundLocalError#93nornewman wants to merge 1 commit intomatatonic:mainfrom
nornewman wants to merge 1 commit intomatatonic:mainfrom
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.