S
Stefan Seefeld
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:
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
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:
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