Skip to content

fix(langproviders): initialize auth_kwargs before conditional assignment in GoogleTranslator - #2597

Open
todkarsant wants to merge 1 commit into
NVIDIA:mainfrom
todkarsant:fix/google-translator-unbound-auth-kwargs
Open

todkarsant wants to merge 1 commit into
NVIDIA:mainfrom
todkarsant:fix/google-translator-unbound-auth-kwargs

Conversation

@todkarsant

Copy link
Copy Markdown

Fixes #2576.

When project_id is None, the auth_kwargs variable was never assigned, causing an UnboundLocalError when it was splatted into translate.Client.from_service_account_json(**auth_kwargs).

Added auth_kwargs = {} before the conditional block so the variable is always defined regardless of whether project_id is set.

@todkarsant

Copy link
Copy Markdown
Author

@jmartin-tech Could you review this? It's a one-line fix for the UnboundLocalError in GoogleTranslator when project_id is None (issue #2576).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GoogleTranslator fails with UnboundLocalError when project_id is unset

1 participant