[IronPython] Internal Assembly Dependency

David Escobar davidescobar1976 at gmail.com
Thu May 27 07:23:13 CEST 2010


I had a similar problem when using ctypes to access a Windows .dll. Before
calling the method that relies on the MathNet.Iridium assembly, try setting
the current working directory to the folder containing your 1st assembly
(the one you reference directly).

clr.AddReferenceToFileAndPath(mypath)
import os
os.chdir(os.path.dirname(mypath))

...then try calling the methods in question.



On Wed, May 26, 2010 at 11:33 AM, Bakalar, Matthew (NIH/CIT) [C] <
bakalarmh at mail.nih.gov> 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
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100526/58e1e8e4/attachment.html>


More information about the Ironpython-users mailing list