[IronPython] import * in exec
Christian Muirhead
christian.muirhead at resolversystems.com
Fri Jan 5 11:06:00 CET 2007
Hi -
We have a case where we'd like to be able to use "from lib import *" in
some code that is exec-ed with a context dictionary. This doesn't appear
to work in IronPython:
ipy:
(func1 is defined in lib.py)
>>> ctx = {}
>>> exec("from lib import *", ctx)
>>> ctx
{}
>>> func1
<function func1 at 0x000000000000002B>
cpython:
>>> ctx = {}
>>> exec("from lib import *", ctx)
>>> ctx
{massive amount of stuff, including names defined in lib}
>>> func1
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
func1
NameError: name 'func1' is not defined
Thanks,
Christian
--
Christian Muirhead
Resolver Systems
christian.muirhead at resolversystems.com
Office address: 17a Clerkenwell Road, London EC1M 5RD, UK
Registered address: 843 Finchley Road, London NW11 8NA, UK
Resolver Systems Limited is registered in England and Wales as company
number 5467329.
More information about the Ironpython-users
mailing list