[IronPython] import * in exec

Haibo Luo haiboluo at exchange.microsoft.com
Fri Jan 5 18:33:15 CET 2007


Should be fixed in latest 1.1 alpha (http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=161). The issue is same as http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=5755

Thanks for reporting this.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Christian Muirhead
Sent: Friday, January 05, 2007 2:06 AM
To: users at lists.ironpython.com
Subject: [IronPython] import * in exec

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.
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list