---
title: "Discussion on \"UnboundLocalError: cannot access local variable where it is not associated with a value in Python: 10 Causes and Fixes (Tested Examples)\" | Hashnode"
description: "Discussion on \"UnboundLocalError: cannot access local variable where it is not associated with a value in Python: 10 Causes and Fixes (Tested Examples)\". Python raises UnboundLocalError: cannot access local variable 'x' where it is not associated with a value when a function reads a name that Python has decided is local to that function, but the line t"
url: "https://hashnode.com/posts/python-unboundlocalerror-cannot-access-local-variable/6af1f9e429c7d0be96a5d767"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [UnboundLocalError: cannot access local variable where it is not associated with a value in Python: 10 Causes and Fixes (Tested Examples)](https://mfaysaldev.hashnode.dev/python-unboundlocalerror-cannot-access-local-variable?utm_source=hashnode&utm_medium=feed)

Python raises UnboundLocalError: cannot access local variable 'x' where it is not associated with a value when a function reads a name that Python has decided is local to that function, but the line t

18h ago · 16 min read · mfaysaldev.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#debugging](https://hashnode.com/tag/debugging)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#webdev](https://hashnode.com/tag/webdev)

## Written by

[Mahir Faysal](https://hashnode.com/@mfaysaldev)

@mfaysaldev

  
[View profile](https://hashnode.com/@mfaysaldev)

Student web developer — PHP, JavaScript, Next.js

I write practical coding tutorials at https://mfaysal.com | Learning cybersecurity on TryHackMe: https://tryhackme.com/p/mfaysal.dev

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
