Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnboundLocalError: local variable 'lang_addr' referenced before assignment #160

Open
qaip opened this issue Jan 17, 2024 · 0 comments
Open

Comments

@qaip
Copy link

qaip commented Jan 17, 2024

Describe the bug

if lang_arg:
lang_addr = ScAddr(int(lang_arg))

The lang_addr variable is declared only in case of lang_arg's existence, but is referenced later regardless.

if lang_addr:
construction.create_edge(sc_types.EDGE_ACCESS_CONST_POS_PERM, 'trans_cmd_addr', lang_addr, 'arc_addr_4')

To Reproduce
Steps to reproduce the behavior:

  1. Make a (regular) POST request to /api/question/answer/translate/ with no lang parameter passed.
  2. See error

Expected behavior
Either a success response or a response indicating that "lang is a required parameter" or "some required parameters are missing".

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

No branches or pull requests

1 participant