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");

 

 

_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to