hi there,
I have trouble running some python code with 'exec':
t.py contains: class Foo: pass class Bar: f = Foo
From a python shell I do:
>>> f = ''.join(open('t.py').readlines()) >>> exec f in {}, {} Traceback (most recent call last): File "<stdin>", line 1, in ? File "<string>", line 2, in ? File "<string>", line 3, in Bar NameError: name 'Foo' is not defined
However, when I use the current global and local scope, i.e. simply 'exec f', everything works fine. What am I missing ?
Thanks, Stefan -- http://mail.python.org/mailman/listinfo/python-list