Object of type int64 is not JSON serializable #117
Replies: 5 comments 2 replies
-
Hey thanks for the feedback What version are you using? I'll take a look at it and roll out a fix tomorrow morning |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response Name: streamlit Name: streamlit_analytics2 Python 3.9.17 Code is
|
Beta Was this translation helpful? Give feedback.
-
Hmm, I ran that code on 0.8.7 and could not get the error. Is the code provided the full code? |
Beta Was this translation helpful? Give feedback.
-
I managed to adjust the code snippet to a working state. The following should work (and also did not reproduce the issue yet) but it is the way to use streamlit and SA2: import streamlit as st
import streamlit_analytics2 as streamlit_analytics
def main():
# Config
st.set_page_config(layout="wide")
st.title('Airport Supply')
_inputs() # this needs to be defined somewhere
_supply_sessions() # this also needs to be defined somewhere
with streamlit_analytics.track():
main() |
Beta Was this translation helpful? Give feedback.
-
Closing as not reproducible |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I just installed streamlit-analytics2 and configured my app but get following error on the analytics page. Please advise
TypeError: Object of type int64 is not JSON serializable
Traceback:
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/runtime/fragment.py", line 248, in wrapped_fragment
result = non_optional_func(*args, **kwargs)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/elements/dialog_decorator.py", line 99, in dialog_content
_ = non_optional_func(*args, **kwargs)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit_analytics2/display.py", line 96, in show_results
st.altair_chart(layer, use_container_width=True)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/runtime/metrics_util.py", line 410, in wrapped_func
result = non_optional_func(*args, **kwargs)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/elements/vega_charts.py", line 1599, in altair_chart
return self._altair_chart(
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/elements/vega_charts.py", line 1804, in _altair_chart
return self._vega_lite_chart(
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/site-packages/streamlit/elements/vega_charts.py", line 1873, in _vega_lite_chart
vega_lite_proto.spec = _stabilize_vega_json_spec(json.dumps(spec))
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/dsw/snapshots/1b75112a-85fa-4b13-9c56-5822402b8861/python39/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
Beta Was this translation helpful? Give feedback.
All reactions