posit-dev / py-shiny

Shiny for Python
https://shiny.posit.co/py/
MIT License
1.1k stars 62 forks source link

Implicit www static dir for Shiny Express doesn't work on shinyapps.io/connect #1440

Closed jcheng5 closed 1 month ago

jcheng5 commented 1 month ago

Create any Shiny Express app.py, and put a www directory next to it with some trivial contents.

shiny run shiny.express.app:app_2e_py

Results in this error:

ValueError: static_assets must be an absolute path: "www". Consider using one of the following instead:
  os.path.join(os.path.dirname(__file__), "www")  OR  pathlib.Path(__file__).parent/"www"

which is what you get on shinyapps.io. However, shiny run app.py works just fine.

The problem seems to be that shiny.express._run.wrap_express_app() takes a file argument that can be relative. I think that should be coerced to an absolute (file = file.absolute()) right at the top of the function body.