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

Stanislas Pinte stan at ertmssolutions.com
Fri Feb 24 16:58:56 CET 2006


Selon Martin Maly <Martin.Maly at microsoft.com>:

> Your TestOther class is not public so IronPython can't access it, hence the exception.
> 
> Martin

Indeed. Thanks for the help!

Stan.

> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of
> Stanislas Pinte
> Sent: Friday, February 10, 2006 4:10 AM
> To: users at lists.ironpython.com
> Subject: [IronPython] Bug in engine.LoadAssembly(...) -> PythonImportError
> 
> 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.
> 
> 
> 
> 
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 
> 


-- 
-----------------------------------------------------------------
   Stanislas Pinte             e-mail: stan at ertmssolutions.com
   ERTMS Solutions               http://www.ertmssolutions.com
   Rue de l'Autonomie, 1             Tel:    + 322 - 522.06.63
   1070        Bruxelles              Fax:   + 322 - 522.09.30
----------------------------------------------------------------- 






More information about the Ironpython-users mailing list