Tabulator assignment destination is read-only when using editing


I am currently developing an application in panel and, for one of the features, I need to use a tabulator in which the user can edit the values in the table with the dataframe getting updated in the background with the edited values, but whatever I do, immediately after changing a value in the table, I get a value error about the destination being read only, I checked the dataframe’s flags and it should be writeable.

I tried to do a test where I removed everything else and just see if the editing works in itself, but I am still getting the same error.

Code to recreate the error:

import pandas as pd
import panel as pn

# Sample DataFrame
data = {'Name': ['John', 'Alice', 'Bob'],
        'Age': [30, 25, 35]}
df = pd.DataFrame(data)

tabulator = pn.widgets.Tabulator(df, height=300)

def update_dataframe(event):
    print('Tabulator edited')
#tabulator.on_edit(print('The table was edited')), 'value')


Full error message:

2024-05-07 10:55:48,303 WebSocket connection closed: code=1001, reason=None
2024-05-07 10:56:52,952 WebSocket connection closed: code=1001, reason=None
2024-05-07 10:56:53,233 WebSocket connection opened
2024-05-07 10:56:53,233 ServerConnection created
2024-05-07 10:56:59,972 error handling message
 message: Message 'PATCH-DOC' content: {'events': [{'kind': 'ColumnsPatched', 'attr': 'data', 'model': {'id': 'p1868'}, 'patches': {'type': 'map', 'entries': [['Age', [[0, 34]]]]}}]}
 error: ValueError('assignment destination is read-only')
Traceback (most recent call last):
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\", line 97, in handle
    work = await handler(message, connection)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\", line 94, in _needs_document_lock_wrapper
    result = func(self, *args, **kwargs)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\", line 286, in _handle_patch
    message.apply_to_document(self.document, self)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\protocol\messages\", line 104, in apply_to_document
    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\", line 443, in invoke_with_curdoc
    return f()
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\protocol\messages\", line 104, in <lambda>
    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\", line 391, in apply_json_patch
    DocumentPatchedEvent.handle_event(self, event, setter)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\", line 245, in handle_event
    event_cls._handle_event(doc, event)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\", line 647, in _handle_event
    model.patch(patches, event.setter)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\models\", line 731, in patch, self, patches, setter)
  File "C:\Users\\AppData\Local\anaconda3\Lib\site-packages\bokeh\core\property\", line 517, in _patch
    self[name][ind] = value
ValueError: assignment destination is read-only```

Hi @Szaban ,
I tried running your code. It works for me, I was able to edit the cells in the tabulator. The update_dataframe function was also triggered.

Ty for the reply. I might have something wrong with my enviroment then, I’ll look into it.

Ran the code in a new enviroment and now it work flawlessly. Seems to be an issue with one of my package installs.