Brian,
Just wanted to share something with you in case it helps the cause. I was
having real trouble getting a custom assembly compiled against 4.0 framework to
import. Technically, it was the open source EPPlus.dll library and I could add
it fine via clr.AddReference("EPPlus") but the import step failed saying "No
module named OfficeOpenXml".
Here's where it gets strange ... the *exact* same source code against the
*exact* same target framework 4.0 created slightly different .dll's when
compiled from VS2010 vs 2012. The one compiled using Vs2010 had no problems
being imported into python.net but the Vs2012 exhibited the behavior above.
It turns out that there's a subtle thing going on:
1) Your ScanAssembly() method inside assemblymanager.cs iterates over all the
types in the assembly to deduce namespaces and adds them to a new dictionary
object (ok so far)
2) But the 2012-compiled ,dll and the 2010-compiled .dll seem to have their
assembly.GetTypes() in slightly different order and your extra "if
(t.IsGenericTypeDefinition) {GenericUtil.Register(t);}" piece of this
ScanAssembly() method was running into some generic types w/o a namespace in
the 2012-compiled .dll "sooner" than they're listed in the 2010-compiled .dll
and blowing things up before any namespaces could be added
To make a long story short, here's what I changed and then all worked again for
me:
BEFORE:
if (t.IsGenericTypeDefinition) {
GenericUtil.Register(t);
}
AFTER:
if (ns != null && t.IsGenericTypeDefinition) {
GenericUtil.Register(t);
}
By the way, I was able to compile a new "Python.Runtime.dll" and "clr.pyd"
(aka, clrmodule.dll) against 4.5 using Visual Studio 2012 without any problems
and load in said EPPLus.dll compiled against 4.5 within my python script. I'm
not sure how robust your module is against a heavy RAM/CPU/IO load, but it's
definitely intriguing to be able to tap into .NET 4.0/4.5 assemblies from
python!!
Cheers,
Tom
_________________________________________________
Python.NET mailing list - PythonDotNet@python.org
http://mail.python.org/mailman/listinfo/pythondotnet