Created
May 3, 2012 21:59
-
-
Save b20n/2589826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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