davidacoder
2013-11-23 19:24:48 UTC
I had the same problem and the following fix in the file
runtime/assemblymanager.cs made things work for me. I believe the problem is
that on Win 8.1 there seem to be generic types that aren't in a namespace.
My patch just skips those and thus prevents a crash. I am not sure whether
that is the right way to handle it, but it does fix the crash.
Best,
David
diff --git a/pythonnet/src/runtime/assemblymanager.cs
b/pythonnet/src/runtime/assemblymanager.cs
index 80c838d..2d369b5 100644
--- a/pythonnet/src/runtime/assemblymanager.cs
+++ b/pythonnet/src/runtime/assemblymanager.cs
@@ -283,7 +283,7 @@ internal class AssemblyManager {
namespaces[ns].Add(assembly, String.Empty);
}
- if (t.IsGenericTypeDefinition) {
+ if (ns !=null && t.IsGenericTypeDefinition) {
GenericUtil.Register(t);
}
}
From: PythonDotNet [mailto:pythondotnet-bounces+btribble=ea.com at
python.org] On Behalf Of Mihhail Maslakov
Sent: Wed Nov 6 11:27:45 CET 2013
To: pythondotnet at python.org
Subject: [Python.NET] Python .NET on Windows 8.1
I have been using python.net for about 5 years for my project at work.
Usually everything worked or at least there was a way to fix it. Right now,
there is a situation, that I cannot understand.
Since my PC got upgraded from W7 to W8.1 imports stopped working. It seems
that something happens on clr module initialization stage, because when I
try clr.AddReference("...") python answers: "AttributeError: 'module'
object has no attribute 'AddReference'"
When debugging with freshly built clr.pyd/Python.Runtime.dll I see that
Runtime.Initialize() finishes without exception and clr module methods are
added via InitializeModuleMembers(). Yet still, when I run my program clr
doesn't work properly and seems like import hooks are not there
(breakpoints at AddReference and other methods are not fired).
Do you have any pointers for me in this situation?
Thank you,
Mihhail Maslakov
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
https://mail.python.org/mailman/listinfo/pythondotnet
runtime/assemblymanager.cs made things work for me. I believe the problem is
that on Win 8.1 there seem to be generic types that aren't in a namespace.
My patch just skips those and thus prevents a crash. I am not sure whether
that is the right way to handle it, but it does fix the crash.
Best,
David
diff --git a/pythonnet/src/runtime/assemblymanager.cs
b/pythonnet/src/runtime/assemblymanager.cs
index 80c838d..2d369b5 100644
--- a/pythonnet/src/runtime/assemblymanager.cs
+++ b/pythonnet/src/runtime/assemblymanager.cs
@@ -283,7 +283,7 @@ internal class AssemblyManager {
namespaces[ns].Add(assembly, String.Empty);
}
- if (t.IsGenericTypeDefinition) {
+ if (ns !=null && t.IsGenericTypeDefinition) {
GenericUtil.Register(t);
}
}
From: PythonDotNet [mailto:pythondotnet-bounces+btribble=ea.com at
python.org] On Behalf Of Mihhail Maslakov
Sent: Wed Nov 6 11:27:45 CET 2013
To: pythondotnet at python.org
Subject: [Python.NET] Python .NET on Windows 8.1
I have been using python.net for about 5 years for my project at work.
Usually everything worked or at least there was a way to fix it. Right now,
there is a situation, that I cannot understand.
Since my PC got upgraded from W7 to W8.1 imports stopped working. It seems
that something happens on clr module initialization stage, because when I
try clr.AddReference("...") python answers: "AttributeError: 'module'
object has no attribute 'AddReference'"
When debugging with freshly built clr.pyd/Python.Runtime.dll I see that
Runtime.Initialize() finishes without exception and clr module methods are
added via InitializeModuleMembers(). Yet still, when I run my program clr
doesn't work properly and seems like import hooks are not there
(breakpoints at AddReference and other methods are not fired).
Do you have any pointers for me in this situation?
Thank you,
Mihhail Maslakov
_________________________________________________
Python.NET mailing list - PythonDotNet-+ZN9ApsXKcEdnm+***@public.gmane.org
https://mail.python.org/mailman/listinfo/pythondotnet