[IronPython] Internal Assembly Dependency

Lukas Cenovsky cenovsky at bakalari.cz
Thu May 27 08:47:43 CEST 2010


Bakalar, Matthew (NIH/CIT) [C] wrote:
>
> Hello All,
>
> I am new to IronPython, relatively new to C#, and new to this list. I 
> have a C# assembly that I am attempting to access from IronPython. I 
> am able to load the assembly using:
>
> clr.AddReferenceToFileAndPath(mypath)
>
> without any problems. I can then import the classes that reside within 
> my assembly as well, create instances of these classes, and call 
> certain methods on these instances. There are methods within this 
> assembly that rely on a reference to another assembly 
> (MathNet.Iridium). When I attempt to call these methods from my 
> IronPython script, I receive the following error:
>
> IOError: [Errno 2] Could not load file or assembly 'MathNet.Iridium, 
> Version=2008.8.16.470, Culture=neutral, 
> PublicKeyToken=c061a3ec32cc0c6f' or one of its dependencies. The 
> system cannot find the file specified.
>
> Now, I never added a reference to MathNet.Iridium in my script. 
> However, I assumed that the C# assembly that I am calling directly was 
> compiled with a reference to this other assembly, and that I would not 
> have to explicitly add a reference. When I create a test assembly 
> entirely in C# that calls the assembly I am attempting to call, and do 
> not include a reference to the MathNet.Iridium assembly, I am able to 
> execute the code without problems. Do I need to add a reference to the 
> MathNet.Iridium assembly from within my IronPython script even though 
> I don't intend to access it directly?
>
> Thanks
>
> Matthew Bakalar
>

First, try to copy all necessary assemblies to the folder with your 
script and use AddReference for all of them. If that works, you can 
experiment with assemblies in different folders.

Note, the path in AddReferenceToFileAndPath should be full path.

--
-- Lukás(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100527/e581c6cb/attachment.html>


More information about the Ironpython-users mailing list