[IronPython] __import__ bugs?

Dino Viehland dinov at exchange.microsoft.com
Fri Aug 25 21:39:45 CEST 2006


Thanks for the bug report Kurt.  I've opened CodePlex bug #2599 to track the issue (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=2599 )

We currently don't allow assignment to __builtins__ - this is a known incompatibility that we'll document for the time being and fix in the future.  The from list is just a simple bug that we should fix - I've tentatively opened this as a 1.01 bug.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kurt Blackwell
Sent: Sunday, August 20, 2006 12:03 AM
To: users at lists.ironpython.com
Subject: [IronPython] __import__ bugs?

I'm quite new to Python in general, but one of the first things I wanted to try was to get IronPython to load scripts out of my own virtual directory system.  __import__ seemed like a good place to start, but IronPython seems to be doing things differently from CPython.

CPython expects you to overwrite __import__ in __builtins__, but that is read only in IronPython.  As far as I can tell, IronPython will only use your __import__ if it's a global.

The other thing is that the fromlist doesn't get what I would expect.
Given the following:

def __import__(name, globals, locals, fromlist):
     print fromlist
from a import b

CPython will print "('b',)", but IronPython will print "[None]".  I'm guessing that's a bug.



_______________________________________________
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