> I'm probably fundamentally misunderstanding the way the interpreter > works with regard to scope, but is this the intended behavior... >
[....] > SOMEGLOBAL: > Traceback (most recent call last): > File "unboundlocal.py", line 15, in ? > foo() > File "unboundlocal.py", line 11, in foo > print "SOMEGLOBAL:",SOMEGLOBAL > UnboundLocalError: local variable 'SOMEGLOBAL' referenced before assignment [......] > import os,sys > > SOMEGLOBAL=1 > > def foo(): > dome=False > if dome: > SOMEGLOBAL = 0 > > print globals() > print "SOMEGLOBAL:",SOMEGLOBAL > > print os.uname() > print sys.version > foo() > Try: import os,sys SOMEGLOBAL=1 def foo(): global SOMEGLOBAL dome=False if dome: SOMEGLOBAL = 0 print globals() print "SOMEGLOBAL:",SOMEGLOBAL print os.uname() print sys.version foo() HTH, Daniel -- http://mail.python.org/mailman/listinfo/python-list