Skip to content

Instantly share code, notes, and snippets.

@b20n
Created May 3, 2012 21:59
Show Gist options
  • Save b20n/2589826 to your computer and use it in GitHub Desktop.
Save b20n/2589826 to your computer and use it in GitHub Desktop.
import sys
def foo():
if False:
import sys
sys.exit(1)
print sys.argv[0]
foo()
# ➜ tmp python foo.py
# Traceback (most recent call last):
# File "foo.py", line 9, in <module>
# foo()
# File "foo.py", line 7, in foo
# print sys.argv[0]
# UnboundLocalError: local variable 'sys' referenced before assignment
# ➜ tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment