Skip to content

Flask-cache cannot cache go.Layout and go.scatter object #139

Closed
@flamingofugang

Description

@flamingofugang

Hi,

I tried to use Flask-Cache according to this post: https://plot.ly/dash/performance
I have a callback function to update the figure of a dcc.Graph, the figure is a dict of data and layout, both of which are plotly.graph_objs, something like:
@cache.memoize(timeout=60)
def update_figure(value):
return {'data': [], 'layout': go.Layout()}

I got the NoneType error message:
File "/local/anaconda3/envs/tsmodel/lib/python3.6/site-packages/werkzeug/contrib/cache.py", line 582, in dump_object
return b'!' + pickle.dumps(value)
TypeError: 'NoneType' object is not callable

I think the plotly.graph_objs cannot be serielized in this case, how to solve this issue?

Best,
Gang

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions