zauberzeug / nicegui

Create web-based user interfaces with Python. The nice way.
https://nicegui.io
MIT License
10.11k stars 606 forks source link

Native mode error on Windows #3813

Closed cgfxpy closed 1 month ago

cgfxpy commented 1 month ago

Description

All applications made with NiceGui stopped working after refreshing the browser an error is triggered:

[pywebview] WebView2 initialization failed with exception:
  (0x8007139F): The group or resource is not in the right state to perform the required operation. (HRESULT exception: 0x8007139F)
   in System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   In Microsoft.Web.Web.WebView2.Core.CoreWebView2Environment.<CreateCoreWebView2ControllerAsync>d8.MoveNext()
--- End stack trace from the previous location where the exception occurred ---
   in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in Microsoft.Web.WebView2.WinForms.WebView2.<InitCoreWebView2Async>d26.MoveNext()
falkoschindler commented 1 month ago

Hi @cgfxpy, When did the applications stop working? How to reproduce the error? Does it even occur with a simple hello-world app? Can you, please, try to create a minimum reproducible code example? This would allow us and the community to help more efficiently. Thanks! Why is it important to provide a minimal reproducible example?

python-and-fiction commented 1 month ago

@cgfxpy Have you tried pywebview's example?

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

It seems that it is a problem of pywebview or your environment.

cgfxpy commented 1 month ago

Yes this example has the same behavior. I should add this error occurs when running in Pycharm and from freeze in pyinstaller when running from cmd this problem is not detected.

rodja commented 1 month ago

Ok. The error should be reported directly to pywebview. I'll close it here.