Switch shinyswatch.theme.<theme_name> -> shinyswatch.theme.<theme_name>() for py-shinylive
coatless opened this issue · comments
James J Balamuta commented
If we take the demo app listed in the README and place it into a py-shinylive app, then we get an error
TypeError: Invalid tag item type: . Consider calling str() on this value before treating it as a tag item
Traceback (most recent call last):
File "<exec>", line 381, in _start_app
File "/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1053, in _gcd_import
File "<frozen importlib._bootstrap>", line 1030, in _find_and_load
File "<frozen importlib._bootstrap>", line 1009, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pyodide/app_xfw4jdffnf9ri4l3857k/app.py", line 5, in <module>
app_ui = ui.page_fluid(
File "/lib/python3.10/site-packages/shiny/ui/_page.py", line 386, in page_fluid
div({"class": "container-fluid"}, *args, **kwargs), title=title, lang=lang
File "/lib/python3.10/site-packages/htmltools/tags.py", line 731, in div
return Tag("div", *args, _add_ws=_add_ws, **kwargs)
File "/lib/python3.10/site-packages/htmltools/_core.py", line 564, in __init__
self.children = TagList(*kids)
File "/lib/python3.10/site-packages/htmltools/_core.py", line 186, in __init__
super().__init__(_tagchilds_to_tagnodes(args))
File "/lib/python3.10/site-packages/htmltools/_core.py", line 1723, in _tagchilds_to_tagnodes
raise TypeError(
TypeError: Invalid tag item type: <class 'function'>. Consider calling str() on this value before treating it as a tag item.
If we change the theme line to use parentheses instead of being treated as an object, then the shinylive app works
Garrick Aden-Buie commented
Thanks @coatless! It looks like shinyswatch is out of date in shinylive, the syntax in the README requires shinyswatch 0.5.0.
>>> shinyswatch.__version__
'0.4.1'
The example you provided runs correctly for me locally with Shiny Express and the latest shinyswatch.
Winston Chang commented
I pushed a fix in posit-dev/shinylive@93f4c1a, which should be deployed shortly.