nicegui: Missing static files and lost connection after upgrade to 1.2.4

Description

I’m trying to run the standard “Hello NiceGui” script on a clean install in a virtrualenv on Python 3.9 and I’m getting several error messages.

from nicegui import ui
ui.label("Hello NiceGUI")
ui.run()

The browser has the message “Connection lost. Trying to reconnect…” and the console displays the following messages:

http://127.0.0.1:8080/_nicegui/1.2.4/static/socket.io.min.js not found http://127.0.0.1:8080/_nicegui/1.2.4/static/nicegui.css not found http://127.0.0.1:8080/_nicegui/1.2.4/static/quasar.prod.css not found http://127.0.0.1:8080/_nicegui/1.2.4/static/fonts.css not found http://127.0.0.1:8080/_nicegui/1.2.4/static/quasar.umd.prod.js not found http://127.0.0.1:8080/_nicegui/1.2.4/static/tailwindcss.min.js not found http://127.0.0.1:8080/_nicegui/1.2.4/static/vue.global.prod.js not found http://127.0.0.1:8080/_nicegui/1.2.4/static/quasar.umd.prod.js not found

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 35 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@falkoschindler #720 worked for me on mac with PyInstaller awesome job!

@falkoschindler PR #720 works correctly on Windows with a venv. Thank you for your fast response!

@falkoschindler Sure

Darwin
directory = PosixPath('/Users/myusername/code/python/myproject/venv/lib/python3.10/site-packages/nicegui/static')
os.path.abspath(directory)  = '/Users/myusername/code/python/myproject/venv/lib/python3.10/site-packages/nicegui/static'
os.path.realpath(directory) = '/Users/myusername/code/python/myproject/venv/lib/python3.10/site-packages/nicegui/static'

@kiwifoxtrot Thanks a lot! This is enough information to finally understand the problem. I opened a discussion over at Starlette: https://github.com/encode/starlette/discussions/2111

Now we only need to decide what that means for our hotfix.

directory = WindowsPath('C:/Users/username/Envs/venv_name/lib/site-packages/nicegui/static')
os.path.abspath(directory)  = 'C:\\Users\\username\\Envs\\venv_name\\lib\\site-packages\\nicegui\\static'
os.path.realpath(directory) = 'C:\\Users\\username\\Envs\\venv_name\\Lib\\site-packages\\nicegui\\static'

You are correct.

Can you try to locate the follow_symlinks parameter in nicegui.py and set it to False? We introduced this one in 1.2.4 to fix NiceGUI in environments like replit.com. But maybe this causes new problems.

The code above returns “1.2.4”, tried a second clean virtualenv and installing with no cache. No other apps are running on that PC.