app_ui = ui.page_fluid(
ui.h1("Using pygwalker with Shiny"),
ui.markdown("This is a demo of using pygwalker with Shiny."),
ui.HTML(pyg.walk(df, spec="./viz-config.json", return_html=True, debug=False)),
)
def server(input, output, session):
...
app = App(app_ui, server)
app.run()`
Process SpawnProcess-1:
Traceback (most recent call last):
File "C:\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Python312\Lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn_subprocess.py", line 80, in subprocess_started
target(sockets=sockets)
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\base_events.py", line 684, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 69, in serve
await self._serve(sockets)
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 76, in _serve
config.load()
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\config.py", line 434, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\importlib__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 994, in exec_module
File "", line 488, in _call_with_frames_removed
File "D:\Projects\pyg\app.py", line 19, in
app.run()
File "D:\Projects\pyg.venv\Lib\site-packages\shiny_app.py", line 271, in run
run_app(self, **kwargs) # pyright: ignore[reportArgumentType]
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\pyg.venv\Lib\site-packages\shiny_main.py", line 365, in run_app
uvicorn.run( # pyright: ignore[reportUnknownMemberType]
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\main.py", line 577, in run
server.run()
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 190, in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'Server.serve' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
`from shiny import App, ui import pygwalker as pyg from datasets import load_dataset
dataset = load_dataset("gradio/NYC-Airbnb-Open-Data", split="train") df = dataset.to_pandas()
app_ui = ui.page_fluid( ui.h1("Using pygwalker with Shiny"), ui.markdown("This is a demo of using pygwalker with Shiny."), ui.HTML(pyg.walk(df, spec="./viz-config.json", return_html=True, debug=False)), )
def server(input, output, session): ...
app = App(app_ui, server)
app.run()`
Process SpawnProcess-1: Traceback (most recent call last): File "C:\Python312\Lib\multiprocessing\process.py", line 314, in _bootstrap self.run() File "C:\Python312\Lib\multiprocessing\process.py", line 108, in run self._target(*self._args, **self._kwargs) File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn_subprocess.py", line 80, in subprocess_started target(sockets=sockets) File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\asyncio\base_events.py", line 684, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 69, in serve await self._serve(sockets) File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 76, in _serve config.load() File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\config.py", line 434, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\importer.py", line 19, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\importlib__init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 994, in exec_module
File "", line 488, in _call_with_frames_removed
File "D:\Projects\pyg\app.py", line 19, in
app.run()
File "D:\Projects\pyg.venv\Lib\site-packages\shiny_app.py", line 271, in run
run_app(self, **kwargs) # pyright: ignore[reportArgumentType]
^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\pyg.venv\Lib\site-packages\shiny_main.py", line 365, in run_app
uvicorn.run( # pyright: ignore[reportUnknownMemberType]
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\main.py", line 577, in run
server.run()
File "D:\Projects\pyg.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\asyncio\runners.py", line 190, in run
raise RuntimeError(
RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'Server.serve' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback