Re: [Python.NET] Python .NET on Windows 8.1
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
davidacoder <davidacoder@...> writes:
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 <at> <at> -283,7 +283,7 <at> <at> 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@... https://mail.python.org/mailman/listinfo/pythondotnet
Hi! I am having this problem too. Since I upgraded to Windows 8.1. today my Python.net installation has stopped working: import clr SystemError: dynamic module not initialized properly I have not built my own Python.net (and would rather not if possible as I am not sure what is involved - I suspect I would have to set up lots of things I currently don't have, but just used the latest version at http://sourceforge.net/projects/pythonnet/files/. Has anyone rebuilt Python.net using the patch suggested in David's message above, and either has, or is willing to, make it publicly available somewhere in a gzipped form that could just be downloaded and copied into my Python setup. I would be really really grateful! Many thanks. Hoping ... Rudi
participants (2)
-
davidacoder
-
Rudi Lutz