Closed
Description
Hi,
I am following this docs to generate a gantt chart https://github.com/plotly/plotly.py/blob/doc-prod/doc/python/gantt.md
But this is what I get:
Traceback (most recent call last):
File "/home/ccu/ccu/mesa-performance-tracking/mesa-ci-status/gantt-chart-test.py", line 12, in <module>
fig.show()
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/basedatatypes.py", line 3390, in show
return pio.show(self, *args, **kwargs)
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/io/_renderers.py", line 403, in show
renderers._perform_external_rendering(fig_dict, renderers_string=renderer, **kwargs)
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/io/_renderers.py", line 340, in _perform_external_rendering
renderer.render(fig_dict)
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/io/_base_renderers.py", line 748, in render
html = to_html(
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/io/_html.py", line 144, in to_html
jdata = to_json_plotly(fig_dict.get("data", []))
File "/home/ccu/.local/lib/python3.10/site-packages/plotly/io/_json.py", line 123, in to_json_plotly
return json.dumps(plotly_object, cls=PlotlyJSONEncoder, **opts)
File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/home/ccu/.local/lib/python3.10/site-packages/_plotly_utils/utils.py", line 59, in encode
encoded_o = super(PlotlyJSONEncoder, self).encode(o)
File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/ccu/.local/lib/python3.10/site-packages/_plotly_utils/utils.py", line 136, in default
return _json.JSONEncoder.default(self, obj)
File "/usr/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type timedelta is not JSON serializable
I installed with pip, and the version is the same indicated on top here https://plotly.com/python/gantt/
ccu@ginger ~/c/mesa (cuttlefish)> pip show plotly
Name: plotly
Version: 5.14.0
Summary: An open-source, interactive data visualization library for Python
Home-page: https://plotly.com/python/
Author: Chris P
Author-email: chris@plot.ly
License: MIT
Location: /home/ccu/.local/lib/python3.10/site-packages
Requires: packaging, tenacity
Required-by:
So I'm wondering if this is a bug or if I'm doing something wrong, or maybe the docs is outdated (and I can help with that once I figure the right way to implement it).
Thanks.
Metadata
Metadata
Assignees
Labels
No labels