Replies: 3 comments 6 replies
|
It's working for me after I changed |
UpdateI installed nicegui on a fresh mac system with pip. Browser mode works fine. But native mode crashes without even opening a window. Thankfully it gave a helpful error message to console, see below. This time I'm running exact code from nicegui styling example with one change: add The first error is caused by fork. I have experience with this. Unfortunately python fork on macos does bad things. For instance see this thread in cpython project. I found two fixes for fork issues that may help, but neither works in 100% of cases. Because of these issues, the multiprocessing package switched from fork to spawn on macos as default process start method as of python 3.8 (see note after start methods or discussion here). TriggersDoes nicegui issue any forks? I found the word fork several times in the github code, but no calls to os.fork that I could see. It can also be triggered by starting processes with mp. I see native_mode.py creates a new process on lines 107-110: I don't see an mp context being used, and I can't find mp.set_start_method called elsewhere in nicegui code. However perhaps another lib nicegui depends on calls set_start_method ('fork'). This would change the start method globally, affecting nicegui mp processes. I also saw use of mp.Queue and mp.Manager in nicegui, which can create processes that trigger fork bugs. It's always a good idea to use an explicit context with multiprocessing. Third, the bug could be triggered by libraries nicegui uses that call os.fork () directly. I don't feel up to searching all that code. :) But we can probably limit it to libs nicegui uses that pywebview doesn't, since pywebview works fine on my machine. Error messageThere's another error about bad file descriptor that I don't understand the code enough to decipher. Anyway that seems secondary, triggered during shutdown. Perhaps it makes sense to someone else. |
|
check your system proxy |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Question
Hi, I'm getting started with nicegui. Looks fantastic so far. I can open a webpage interface no problem, using the styling example. Everything displays as it should.
When I switch to native mode, things fall apart. A window opens. Titlebar and window size are correct from params to ui.run. But window content is completely empty. Just a blank white canvas with no text or anything.
Question
Can anyone point me to more info on this problem, or how to gather debug info? I'm drawing a blank so far.
What I tried
I'm running on mac. I don't see any errors in the terminal. All I get is this:
I read the docs and discussion board, tried ui.page decorator, tried the port arg to ui.run, tried reload = false, nothing changes. Native window is always blank. I even ran all the code at top level of the script, not wrapped in main (). Doesn't make a difference.
Code
Here's my code.
Environment
Here's my setup (revelant packages only):
Oh one more thing. Pywebview runs just fine. I can open a native window with content, no problem. For example this works perfectly fine:
Any suggestions how to figure this out?
All reactions