[Python.NET] System.TypeInitializationException

Sandro Hardy sandrohardy at web.de
Wed Oct 22 22:25:35 CEST 2008


Hi,

this Code:
---------------------------------------------------------
def stateChanged():
         print "sdf"

bb.WiimoteChanged += System.EventHandler(stateChanged);
---------------------------------------------------------

ist working in a cygwin xterm. (no python installed in cygwin)


But ist gives me this error in a Windows shell:

Unhandled Exception: System.TypeInitializationException: The type 
initializer fo
r 'Python.Runtime.CodeGenerator' threw an exception. ---> 
System.InvalidCastExce
ption: Unable to cast object of type 'System.Reflection.Module' to type 
'System.
Reflection.Emit.ModuleBuilder'.
    at 
System.Reflection.Emit.AssemblyBuilderData.GetInMemoryAssemblyModule()
    at System.AppDomain.InternalDefineDynamicAssembly(AssemblyName name, 
Assembly
BuilderAccess access, String dir, Evidence evidence, PermissionSet 
requiredPermi
ssions, PermissionSet optionalPermissions, PermissionSet 
refusedPermissions, Sta
ckCrawlMark& stackMark, IEnumerable`1 unsafeAssemblyAttributes)
    at System.AppDomain.DefineDynamicAssembly(AssemblyName name, 
AssemblyBuilderA
ccess access)
    at Python.Runtime.CodeGenerator..cctor()
    --- End of inner exception stack trace ---
    at Python.Runtime.DelegateManager.GetDispatcher(Type dtype)
    at Python.Runtime.DelegateManager.GetDelegate(Type dtype, IntPtr 
callable)
    at Python.Runtime.DelegateObject.tp_new(IntPtr tp, IntPtr args, 
IntPtr kw)
    at e__NativeCall.Call_3(IntPtr , IntPtr , IntPtr , IntPtr )
    at Python.Runtime.MetaType.tp_call(IntPtr tp, IntPtr args, IntPtr kw)
    at Python.Runtime.Runtime.Py_Main(Int32 argc, String[] argv)
    at Python.Runtime.PythonConsole.Main(String[] args)

Any hints?
Regards,
Sandro


More information about the PythonDotNet mailing list