webui icon indicating copy to clipboard operation
webui copied to clipboard

Failed to start a new window after closing a window

Open BHznJNs opened this issue 7 months ago • 5 comments

I am trying to use the python wrapper and have codes like following:

from time import sleep
from webui import webui

window = webui.Window()
window.show("<html><script src='webui.js'></script> Hello World from Python! </html>")
webui.wait()
window = None
sleep(1)
window = webui.Window()
window.show("<html><script src='webui.js'></script> Hello World from Python! </html>")

When I run it, I met error like this:

Traceback (most recent call last):
  File "d:\MyPrograms\python_programs\adb_control\src\ui\connect.py", line 48, in <module>
    window = webui.Window()
             ^^^^^^^^^^^^^^
  File "C:\Users\44176\.pyenv\pyenv-win\versions\3.11.9\Lib\site-packages\webui\webui.py", line 625, in __init__
    raise RuntimeError("Failed to create a new WebUI window.")
RuntimeError: Failed to create a new WebUI window.

I tried to clear resources after closing the first window:

from time import sleep
from webui import webui

window = webui.Window()
window.show("<html><script src='webui.js'></script> Hello World from Python! </html>")
webui.wait()
window = None
webui.clean() # clear resources
sleep(1)
window = webui.Window()
window.show("<html><script src='webui.js'></script> Hello World from Python! </html>")

Then I met such an error:

Traceback (most recent call last):
  File "d:\MyPrograms\python_programs\adb_control\src\ui\connect.py", line 49, in <module>
    window = webui.Window()
             ^^^^^^^^^^^^^^
  File "C:\Users\44176\.pyenv\pyenv-win\versions\3.11.9\Lib\site-packages\webui\webui.py", line 619, in __init__
    self._window = int(_raw.webui_new_window())
                       ^^^^^^^^^^^^^^^^^^^^^^^
OSError: exception: access violation writing 0x0000000000000024

Does the webui supports restarting?

BHznJNs avatar May 03 '25 04:05 BHznJNs