You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jreyesr June 17, 2023
Hello! I've been exploring Streamsync (awesome tool, BTW!) and I found out that apparently datetime.datetime instances cannot be serialized and sent to the frontend.
Serialisation error
Traceback (most recent call last):
File "/home/reyes/.local/lib/python3.10/site-packages/streamsync/core.py", line 239, in to_dict
serialised_value = state_serialiser.serialise(value)
File "/home/reyes/.local/lib/python3.10/site-packages/streamsync/core.py", line 129, in serialise
raise StateSerialiserException(
streamsync.core.StateSerialiserException: Object of type <class 'datetime.datetime'> (MRO: ['datetime.datetime', 'datetime.date', 'builtins.object']) cannot be serialised.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/reyes/.local/lib/python3.10/site-packages/streamsync/app_runner.py", line 120, in _handle_session_init
user_state = session.session_state.user_state.to_dict()
File "/home/reyes/.local/lib/python3.10/site-packages/streamsync/core.py", line 241, in to_dict
raise ValueError(
ValueError: Couldn't serialise value of type "<class 'datetime.datetime'>" for key "now".
As far as I can tell, this is due to the serialization code not supporting datetime.datetime instances
Background: I ran across this when trying to replicate Streamlit's starter tutorial in Streamsync. This tutorial has a Pandas DataFrame with a datetime column (it's a special Pandas datetime class, but it eventually inherits from Python's datetime.datetime)
Adding support for this would let users display data that has timestamp-style columns, such as "created on", "event time" and such.
Is there any interest in letting users pass datetime instances to the FE? I don't see any issues or discussions mentioning it, but it may be because Streamsync is fairly new. Any ideas?
The text was updated successfully, but these errors were encountered:
Discussed in #40
Originally posted by jreyesr June 17, 2023
Hello! I've been exploring Streamsync (awesome tool, BTW!) and I found out that apparently
datetime.datetime
instances cannot be serialized and sent to the frontend.Minimal example
This causes the following error to appear:
Error
As far as I can tell, this is due to the serialization code not supporting
datetime.datetime
instancesBackground: I ran across this when trying to replicate Streamlit's starter tutorial in Streamsync. This tutorial has a Pandas DataFrame with a datetime column (it's a special Pandas datetime class, but it eventually inherits from Python's
datetime.datetime
)Adding support for this would let users display data that has timestamp-style columns, such as "created on", "event time" and such.
Is there any interest in letting users pass datetime instances to the FE? I don't see any issues or discussions mentioning it, but it may be because Streamsync is fairly new. Any ideas?
The text was updated successfully, but these errors were encountered: