[IronPython] clr.AddRefernce* woes

Stanislas Pinte stan at phidani.be
Fri Feb 24 11:02:22 CET 2006


Selon Dan Shechter <dans at houmus.org>:

> Perhaps I wasn't being clear:
> I have been able to use your suggested workaround to load .NET "Core"
> assemblies such as System.Xml etc.

I am able to do that with the following code: (don't know if it is the recommended way)

ClrModule.AddAssembly(Assembly.LoadFrom(currentDirName + Path.DirectorySeparatorChar +
"MyPackage.dll")); 

--> all namespaces inside MyPackage.dll are then magically available in the python engine. 

> 
> My problem is that I don't have a working workaround for Assemblies like
> mapack.dll or my own assemblies which reside in some other directory (like
> the IronPython tutorial directory).
> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
> Sent: Friday, February 24, 2006 04:08
> To: Discussion of IronPython
> Subject: Re: [IronPython] clr.AddRefernce* woes
> 
> There were a couple of bugs w/ assembly loading in beta 3.  
> 
> As a work around you should be able to do:
> 
> import System
> clr.AddReference(System.Reflection.Assembly.Load('System.Xml'))
> 
> clr.AddReference(System.Reflection.Assembly.LoadFrom('System.Xml'))
> 
> clr.AddReference(System.Reflection.Assembly.LoadWithPartialName('System.Xml'
> ))
> 
> 
> Obviously we'll have it fixed in beta 4.
> 
> 
> Do you want to help develop Dynamic languages on CLR?
> (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F
> 0-45DF-8B78-DC1B43134038)
> 
> -----Original Message-----
> From: users-bounces at lists.ironpython.com
> [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Shechter
> Sent: Thursday, February 23, 2006 4:19 PM
> To: users at lists.ironpython.com
> Subject: [IronPython] clr.AddRefernce* woes
> 
> Hi,
> I've just installed beta 3 drop but I can't use clr.AddReference to anything
> that isn't part of .NET 2.0 core libraries.
> I'm trying to load a .NET 2.0 compiled assembly. "PERWAPI.dll", I have a
> test.exe console c# program
> which does invoke methods and instantiate classes defined within that DLL.
> I'm also having problems with the tutorial "demo" using mapack.dll., I've
> provided a transcript below:
> ---------------------------------------- CUT HERE
> ----------------------------
> >>> import clr
> >>> clr.AddReference("System.XML")
> - Crashed
> 
> >>> import clr
> >>> clr.AddReferenceByPartialName("System.XML")
> - works
> 
> >>> clr.AddReferenceByPartialName("Mapack")
> Traceback (most recent call last):
>   File , line 0, in input##152
>   File , line 0, in AddReferenceByPartialName##81
> RuntimeError: Could not add reference to assembly Mapack
> 
> >>> clr.Path
> []
> 
> >>> clr.Path.append(System.Environment.CurrentDirectory)
> 
> >>> clr.Path
> ['C:\\Development\\IronPython\\Tutorial']
> 
> >>> clr.AddReferenceByPartialName("Mapack")
>  - Crashed
> ---------------------------------------- CUT HERE
> ----------------------------
> 
> Naturally the same happens for PERWAPI.dll (which I'm really interested in
> getting to work) and naturally,
> Both .DLLs (PERWAPI.DLL & MAPACK.DLL) are in the '
> C:\Development\IronPython\Tutorial'' on my machine...
> 
> Any ideas?
> 
> 
> 
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 
> 
> _______________________________________________
> 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