In the code below, bar() seems to work, foo() seems broken. % python -V Python 2.6.1
% cat exec1.py def foo(i) : exec "i = i + 1" in locals(), globals() print "i=%d" % i def bar(j) : exec "j = j + 1" print "j=%d" % j foo(0) bar(0) % python exec1.py i=0 j=1 What I really wanted to do was something like: exec text in globals(), inspect.currentframe(1).f_locals but that didn't work either. Thanks, Charlie -- http://mail.python.org/mailman/listinfo/python-list