繁体   English   中英

Python pywebview webview.start() System.NullReferenceException object reference not set at System.Windows.Forms.Control.get_CacheTextInternal()

[英]Python pywebview webview.start() System.NullReferenceException object reference not set at System.Windows.Forms.Control.get_CacheTextInternal()

我按照https://pypi.org/project/pywebview/中显示的方式进行了安装,并且我使用了示例代码

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

这是我得到的完整错误

Unbehandelte Ausnahme: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei System.Windows.Forms.Control.get_CacheTextInternal()
   bei System.Windows.Forms.Control.get_Text()
   bei System.Windows.Forms.Control.set_Text(String value)
--- Ende der Stapel�berwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel�st wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Python.Runtime.PythonException.ThrowLastAsClrException()
   bei Python.Runtime.Dispatcher.TrueDispatch(Object[] args)
   bei Python.Runtime.Dispatcher.Dispatch(Object[] args)
   bei __System_Threading_ThreadStartDispatcher.Invoke()
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()

我尝试调试 webview.start()。 尽管windows[0]不为空,但它在guilib.create_window(windows[0])处崩溃

有同样的问题,可以通过将 pythonnet 的版本降低到“3.0.0a2”来解决它。 之后的一切(截至目前/13.07.2022)都不再起作用了。 以下是诀窍:

pip install pythonnet==3.0.0a2

在 windows 10 上使用 pywebview 版本 3.6.3 进行了测试

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM