We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if __name__ == "__main__":
The following code runs fine:
from nicegui import ui ui.label('some label') ui.run()
However, the two following code-snippets do not run:
from nicegui import ui if __name__ == "__main__": ui.label('some label') ui.run()
if __name__ == "__main__": from nicegui import ui ui.label('some label') ui.run()
In both cases, the raised error looks like the following.
←[31mERROR←[0m: Traceback (most recent call last): File "F:\Python\lib\site-packages\starlette\routing.py", line 671, in lifespan async with self.lifespan_context(app): File "F:\Python\lib\site-packages\starlette\routing.py", line 566, in __aenter__ await self._router.startup() File "F:\Python\lib\site-packages\starlette\routing.py", line 650, in startup handler() File "F:\Python\lib\site-packages\nicegui\nicegui.py", line 59, in handle_startup print(f'NiceGUI ready to go on http://{globals.host}:{globals.port}') AttributeError: module 'nicegui.globals' has no attribute 'host' ←[31mERROR←[0m: Application startup failed. Exiting. Task raised an exception Traceback (most recent call last): File "F:\Python\lib\site-packages\nicegui\background_tasks.py", line 57, in _handle_task_result task.result() File "F:\Python\lib\site-packages\nicegui\binding.py", line 27, in loop await asyncio.sleep(globals.binding_refresh_interval) AttributeError: module 'nicegui.globals' has no attribute 'binding_refresh_interval'
The text was updated successfully, but these errors were encountered:
Related: #181
# workaround from nicegui import ui if __name__ in {"__main__", "__mp_main__"}: ui.label("some label") ui.run()
Sorry, something went wrong.
Didn't spot that one, thanks for mentioning it!
I'll close this issue. If someone has an idea on how to improve the error message a pull request would be welcome.
No branches or pull requests
The following code runs fine:
However, the two following code-snippets do not run:
In both cases, the raised error looks like the following.
The text was updated successfully, but these errors were encountered: