clr.AddReferenceToFile() fails in IronPython 2.7
Asked Answered
O

3

6

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 fails in IronPython 2.7 alpha 1 with an IOException, and the message:

Could not add reference to assembly wiimotelib.dll

Is this new behaviour in 2.7, or is it an alpha release bug?

Oddfellow answered 11/9, 2010 at 20:26 Comment(0)
P
4

Could this be a .NET 2 vs .NET 4 problem? IronPython 2.7A1 is .NET 4.0 only. 2.6 had both .NET 2 and .NET 4 versions. If the assembly is a .NET 2 assembly it might not load on the .NET 4 CLR.

Pfaff answered 11/9, 2010 at 20:52 Comment(1)
The DLL is well over a year old, so it won't be .NET 4. Guess I'll have to hope a newer version comes out one day.Oddfellow
S
2

You have to recompile the WiimoteLib Assembly. I've had the same problem. After recompilation it was gone.

Socman answered 19/12, 2010 at 14:13 Comment(0)
D
0

I think in IronPython 2.7 was removed the need for the "DLL" extension:

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

Worked for me.

Dragonroot answered 19/8, 2013 at 20:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.