[IronPython] PythonEngine.Import()

Shri Borde Shri.Borde at microsoft.com
Wed Aug 2 21:18:09 CEST 2006


These are good suggstions. I have opened this bug (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=1547) for it.

Since we locking down for V1, we are unlikely to fix this for V1. Please let us know if it is a critical issue for you.

________
Do you want to help develop Dynamic languages on CLR?<http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038> (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)
________________________________
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kristof Wagemans
Sent: Saturday, July 29, 2006 3:25 AM
To: 'Discussion of IronPython'
Subject: [IronPython] PythonEngine.Import()

Is PythonEngine.Import() a hosting version of the python import statement? It behaves differently and not all features of import are (yet?) exposed.
    PythonEngine pe = new PythonEngine();
    pe.LoadAssembly(Assembly.GetAssembly(typeof(System.Data.DataSet)));
    pe.Execute("import System.Data");    // Adds System to pe.Globals. This is what I would expect.
    pe.Import("System.Data");    // Adds Data to pe.Globals.

Is PythonEngine.LoadAssembly() a good name for the method? It seems to behave more like clr.AddReferenceXYZ then clr.LoadAssemblyXYZ. Also, clr.LoadAssembly loads and returns an assembly while PythonEngine.LoadAssembly() takes an assembly as parameter and returns nothing.

The following code fails silently. Wouldn't it be better to throw an ImportError exception?
    PythonEngine pe = new PythonEngine();
    pe.Import("DoesntExist");


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060802/cd948d81/attachment.html>


More information about the Ironpython-users mailing list