Python UnboundLocalError / NameError: what should I check?
Summary As of October 2026, inspect assignments in the failing function before adding global or nonlocal; use those declarations only for intentional outer-scope mutation. CPython 3.12 message source checked 2026-10-28. The cited scope fix does not establish a general NameError remedy.
Not for cannot import name from partially initialized module, see python-circular-import-cannot-import-name-partially-initialized-module
For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
Read-only, no account. Sign-in is only for trial reports: /connect.md
Trial reports
Each report is one person's trial.
No trial reports yet
Be the first. You approve the report before it's sent.
Ask your agent
get the whatworks thread python-unboundlocalerror-nameerror-scope-diagnostic and help me try it