Plotly Errors occuring

Has there been a change to the Plotly package recently?
Code that has been working previously with no change that I know of now shows this error:

AttributeError: 'Line' object has no attribute 'to_plotly_json'
at /downlink/anvil_downlink_worker/full_python_worker.py, line 102

Yes, there has been a change to how Plotly server<->client communication is handled, as we updated to the latest Plotly version. However, that error should not be happening! I’ve moved this thread to Bug Reports.

What server runtime environment are you using? (Basic or Full; Python 2 or 3?)

Thanks Meredydd. The environment is Full Python 3

OK, this is a strange one, because this is working just fine for me!

A few steps to narrow it down:

  • If you clone your app, does the failure still occur?

  • If cloning your app keeps the failure: Can you PM me a clone link so I can try replicating?

  • Can you try to reduce your app until you can replicate the issue? That error looks like it occurs when you try to return a Line plot from the server to the client, but when I try that it works just fine.

  • Just a thought: Is the Uplink involved in this call chain at all?

Ok I will try cloning and report back.

No uplink involved.

The problem persists even when cloned.
The server completes all of its analysis and the error only occurs when it tries to return a dict of traces to the client.

The full error is:

AttributeError: 'Line' object has no attribute 'to_plotly_json'
at /downlink/anvil_downlink_worker/full_python_worker.py, line 102
  called from /downlink/anvil/_server.py, line 717
  called from /downlink/anvil/_server.py, line 734
  called from /downlink/anvil/_server.py, line 734
  called from /downlink/anvil/_server.py, line 797
  called from /downlink/anvil/_serialise.py, line 117
  called from /downlink/anvil_downlink_worker/full_python_worker.py, line 56
  called from Dashboard, line 42
  called from Dashboard, line 29
  called from MainForm, line 87

Commenting out the line traces moves the error to:

SerializationError: No such serializable type: plotly.graph_objs.Bar at [Dashboard, line 42](javascript:void(0)) called from [Dashboard, line 29](javascript:void(0)) called from [MainForm, line 87](javascript:void(0))

Hi Rick,

This should be working again now - sorry for the interruption. It happened because the Plotly Line class is deprecated in the latest version of Plotly, and we had inadvertently lost support for it. This will be fixed shortly, but in the meantime we’ve rolled back to the previous working version.

Thanks very much Ian. I had a sneaking suspicion that it was to do with an impending plotly upgrade ?! :wink:

I will try it out in a couple of hours.

On another point, any idea why the anvil.tz.tzlocal stopped working about the same time?

From looking at the Clone link you kindly sent, I believe you hadn’t imported anvil.tz in the module where you were attempting to use it!

1 Like

… well this is awkward :man_facepalming:

Thanks again, plotting is back to normal… and so is anvil.tz.tzlocal :grimacing:

As part of this morning’s maintenance, we have released this plotly change again, with some updates - please could you check that this issue hasn’t re-occurred?

Thanks!

All back to working as per normal thanks Ian.