First Check
Example Code
Description
- Create folder called
xxx.
- Add empty file
__init__.py into xxx.
- Add file
__main__.py into xxx with below contents.
- From level above
xxx run python -m xxx.
__main__.py:
from nicegui import ui
ui.label("xxx")
ui.run(reload=True)
This crashes with:
You must call ui.run() to start the server.
If ui.run() is behind a main guard
if __name__ == "__main__":
remove the guard or replace it with
if __name__ in {"__main__", "__mp_main__"}:
to allow for multiprocessing.
ERROR: Application startup failed. Exiting.
After changing to ui.run(reload=False), it runs as expected. From this, I would conclude that the automatic reloading has problems reloading apps written as modules. Is this expected?
The error message is wrong since the code definitely has ui.run() and does not hide it behind a wrong guard.
NiceGUI Version
3.12.0
Python Version
3.13.13
Browser
Firefox
Operating System
Linux
Additional Context
No response
First Check
Example Code
Description
xxx.__init__.pyintoxxx.__main__.pyintoxxxwith below contents.xxxrunpython -m xxx.__main__.py:This crashes with:
After changing to
ui.run(reload=False), it runs as expected. From this, I would conclude that the automatic reloading has problems reloading apps written as modules. Is this expected?The error message is wrong since the code definitely has
ui.run()and does not hide it behind a wrong guard.NiceGUI Version
3.12.0
Python Version
3.13.13
Browser
Firefox
Operating System
Linux
Additional Context
No response