from panel.io.pyodide import show is obsolete

81 views Asked by At

There was a working pyscript code that used the "show" function from the "panel.io.pyodide" library. After updating panel 24.10.23 the code stopped working. I am new to python. Maybe someone can help me

` Bokeh.set_log_level("info");

<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
  - numpy
  - pandas
  - panel==0.13.1a2
</py-env>

Upload csv

<div id="fileinput"></div>
<div id="upload"></div>
<div id="table"></div>

<py-script>
  import asyncio
  import panel as pn
  import pandas as pd
  from panel.io.pyodide import show

  fileInput = pn.widgets.FileInput(accept='.csv')
  uploadButton = pn.widgets.Button(name='Upload', button_type = 'primary')

  table = pn.widgets.Tabulator(pagination='remote', page_size=10)

  document.getElementById('table').style.display = 'none'

  def process_file(event):
      if fileInput.value is not None:
      table.value = pd.read_csv(io.BytesIO(fileInput.value))
      document.getElementById('table').style.display = 'block'

  uploadButton.on_click(process_file)

  await show(fileInput, 'fileinput')
  await show(uploadButton, 'upload')
  await show(table, 'table')

`

I tried changing the version here - it didn't help. I hope someone can tell me how to import the show function now to make this code work again

0

There are 0 answers