Hey!
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'))
tabulator.param.watch(update_dataframe, 'value')
tabulator.servable()
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\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\protocol_handler.py", line 97, in handle
work = await handler(message, connection)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\session.py", line 94, in _needs_document_lock_wrapper
result = func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\server\session.py", line 286, in _handle_patch
message.apply_to_document(self.document, self)
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\protocol\messages\patch_doc.py", line 104, in apply_to_document
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\callbacks.py", line 443, in invoke_with_curdoc
return f()
^^^
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\protocol\messages\patch_doc.py", line 104, in <lambda>
invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.payload, setter=setter))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\document.py", line 391, in apply_json_patch
DocumentPatchedEvent.handle_event(self, event, setter)
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\events.py", line 245, in handle_event
event_cls._handle_event(doc, event)
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\document\events.py", line 647, in _handle_event
model.patch(patches, event.setter)
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\models\sources.py", line 731, in patch
self.data._patch(self.document, self, patches, setter)
File "C:\Users\user.name\AppData\Local\anaconda3\Lib\site-packages\bokeh\core\property\wrappers.py", line 517, in _patch
self[name][ind] = value
~~~~~~~~~~^^^^^
ValueError: assignment destination is read-only```