r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.67k stars 546 forks source link

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: No support for x86 #281

Closed vanillycpp closed 5 years ago

vanillycpp commented 5 years ago

Specification

Description

run hellow world

import webview
webview.create_window('Hello world', 'https://pywebview.flowrl.com/hello')

have this error

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: No support for x86
   at Python.Runtime.TypeManager.NativeCode.get_Active()
   at Python.Runtime.TypeManager.InitializeNativeCodePage()
   at Python.Runtime.TypeManager.InitializeSlots(IntPtr type, Type impl)
   at Python.Runtime.TypeManager.CreateMetaType(Type impl)
   at Python.Runtime.MetaType.Initialize()
   at Python.Runtime.Runtime.Initialize()
   at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv)
   at Python.Runtime.PythonEngine.InitExt()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at clrModule.PyInit_clr()

have this log while pywebview install

Collecting pywebview
  Using cached https://files.pythonhosted.org/packages/9c/98/2bb83cbe35b09bf5079684f3eeecba2f19d0c90c5cac0ca272539d058d7d/pywebview-2.2.1-py3-none-any.whl
Requirement already satisfied: pythonnet; sys_platform == "win32" in c:\python37\lib\site-packages (from pywebview) (2.4.0.dev0)
Installing collected packages: pywebview
Successfully installed pywebview-2.2.1
r0x0r commented 5 years ago

I don't have a Windows 7 environment ready, but a couple of questions first. a) What .NET version do you have installed? b) Does pythonnet work for you? c) start Python and execute this commands.

import clr

clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Threading')

import System.Windows.Forms as WinForms
from System import IntPtr, Int32, Func, Type, Environment
from System.Threading import Thread, ThreadStart, ApartmentState
from System.Drawing import Size, Point, Icon, Color, ColorTranslator, SizeF

Does this work?

vanillycpp commented 5 years ago

Thanks for answer! .net version is

C:\Users\vanilly>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework
Setup\NDP"

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\CDF
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0

C:\Users\vanilly>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework
Setup\NDP\v4\full" /v version

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full
    version    REG_SZ    4.6.01055

execution of code your asked gives the saim error and it craches on just this

code

import clr

output

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: No support for x86
   at Python.Runtime.TypeManager.NativeCode.get_Active()
   at Python.Runtime.TypeManager.InitializeNativeCodePage()
   at Python.Runtime.TypeManager.InitializeSlots(IntPtr type, Type impl)
   at Python.Runtime.TypeManager.CreateMetaType(Type impl)
   at Python.Runtime.MetaType.Initialize()
   at Python.Runtime.Runtime.Initialize()
   at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv)
   at Python.Runtime.PythonEngine.InitExt()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at clrModule.PyInit_clr()

I have installed pythonnet from master brunch becose of 2.3.0 relsea gives install error I found issue where on that error was gived a recomendation to install pythonnet from master so I did it and got this error :) looks like it`s not problem in your modul, think can close this

r0x0r commented 5 years ago

As a workaround, you may try installing an older version of pythonnet. As far as I know pywebview does not rely on any pythonnet features that would require the latest version.

I am closing this issue now. If you find a resolution, please post it here for a reference.

vanillycpp commented 5 years ago

I started issue on pythonnet page https://github.com/pythonnet/pythonnet/issues/772 and solve this error with installing .net sdk then got problems that MSBuild 14 no supported so I need to install MSBuild 15 (Visual Studio 17) with Win 10 sdk

den-run-ai commented 5 years ago

@vanillycpp the installation for your platform (win7 32-bit) has been fixed in pythonnet