Skip to content

Instantly share code, notes, and snippets.

Created Jul 29, 2019
What would you like to do?
import os
def test_function():
if os.environ.get('SOMETHING_THAT_DOES_NOT_EXIST'):
tail = ''
if tail:
print('Not printed')
Copy link

vjrantal commented Jul 29, 2019

$ python 
Traceback (most recent call last):
  File "", line 9, in <module>
  File "", line 6, in test_function
    if tail:
UnboundLocalError: local variable 'tail' referenced before assignment

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