[IronPython] Bug in engine.LoadAssembly(...) -> PythonImportError

Stanislas Pinte stan at phidani.be
Fri Feb 10 13:09:33 CET 2006


Hello,

I have troubles importing classes defined in my own assembly:

[Release]> ./TestImport.exe

Unhandled Exception: IronPython.Runtime.PythonImportError: No module named Other

   at IronPython.Runtime.ReflectedMethodBase.Invoke(MethodBinding binding)
..
   at TestAccessOtherNamespace.Initialize() in c:TempTestImportTestImportbin
ReleaseTestAccessOtherNamespace.py:line 1

I am actually trying to give access to all the namespaces defined in the main assembly, like that:


class Program
  {
    static void Main(string[] args)
    {
      PythonEngine engine = new PythonEngine();
      //allow python scrupts to import all classes of my assembly
      engine.LoadAssembly(Assembly.GetAssembly(typeof(Program)));
      engine.AddToPath(@".");
      engine.Import("TestAccessOtherNamespace"); 
    }
  }

Am I missing anything? 

See attached full source code (c# program, and python script).

Thanks a lot,

Stan.




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Program.cs
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060210/1e598dc9/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestAccessOtherNamespace.py
Type: application/octet-stream
Size: 53 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060210/1e598dc9/attachment.obj>


More information about the Ironpython-users mailing list