[Ironpython-users] Assembly references: file does not exist?

Doug Blank doug.blank at gmail.com
Thu Jul 14 15:13:19 CEST 2011


On Thu, Jul 14, 2011 at 7:59 AM, Dave Peterson
<dpeterson at broadwaytechnology.com> wrote:
> Turns out that I can put an ipy.exe.config in the install location of IronPython and get my assembly to load.
>
> Does anyone know if there's an equivalent programmatic way to do this?  For example, can I import the clr module, call some .NET methods, and then try my assembly loading?  I'm a .NET noob and I don't see any App or App.Config API when I browse MSDN.   Am I just missing it?

Dave,

I have had no problems by putting the dll path on sys.path. Perhaps
Python is giving you a bad pathDir (maybe leaving out the drive?):

 pathDir = os.path.dirname(FULLPATH)
 sys.path.append(pathDir)

Here is an example where Graphics.dll is in /home/dblank/Calico/modules:

linux$ mono bin/ipy.exe
IronPython 3.0 (3.0.0.0) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> import sys
>>> sys.path.append("/home/dblank/Calico/modules")
>>> clr.AddReference("Graphics.dll")
>>> import Graphics

Hope that helps,

-Doug

>
> -- Dave
>
>
> -----Original Message-----
> From: ironpython-users-bounces+dpeterson=broadwaytechnology.com at python.org [mailto:ironpython-users-bounces+dpeterson=broadwaytechnology.com at python.org] On Behalf Of Dave Peterson
> Sent: Thursday, July 14, 2011 12:32 PM
> To: Markus Schaber; ironpython-users at python.org
> Subject: Re: [Ironpython-users] Assembly references: file does not exist?
>
> Hi Markus,
>
> Just got time to try this out.  When using Assembly.LoadFile(...) I get the following error:
>
> IOError: System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
>
> Ah, it's the issue where .NET 4 doesn't support automatically loading mixed mode assemblies (mine was definitely built as a .NET wrapper around a C++ DLL.)  This can be resolved by updating the App.Config for the application but how do I do that for an IronPython app?
>
>
> -- Dave
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>


More information about the Ironpython-users mailing list