Clr.AddReferenceToFile () does not work in IronPython 2.7

Can someone explain why this code:

import sys sys.path.append("C:\\WINDOWS\\system32") import clr clr.AddReferenceToFile("wiimotelib.dll") 

works fine with IronPython 2.6, but crashes in IronPython 2.7 alpha 1 with IOException and message:

 Could not add reference to assembly wiimotelib.dll 

Is this new behavior in version 2.7, or is it an alpha error?

+6
python ironpython
source share
3 answers

Could this be a .NET 2 vs .NET 4 problem? IronPython 2.7A1 - Only .NET 4.0. 2.6 had both versions of .NET 2 and .NET 4. If the assembly is a .NET 2 assembly, it may not load in the .NET 4 CLR.

+4
source share

You need to recompile the WiimoteLib assembly. I had the same problem. After recompilation, it disappeared.

+2
source share

I think IronPython 2.7 eliminated the need for a DLL extension:

You can try: clr.AddReferenceToFile("wiimotelib");

Worked for me.

0
source share

All Articles