Since I needed Plotly Express (and numpty/Pandas) to generate a figure I chose to generate it on the server.
By print style debugging I have determined that the Dataframe manipulation has succeeded. However when the bar chart is generated (px.bar) I’m getting an error:
anvil.server.RuntimeUnavailableError: Downlink disconnected: 9ef5121ed39b
at Form1, line 19
Please note that the px.bar call is correct because if I use a anvil uplink script on my local system the correct graph is generated (with figure.show()).
I beg to differ. Plotly handles this just fine when run standalone. It is only when run with Anvil one gets the weird error.
I don’t understand why this specific error occurs.
I don’t have all of the required answers. What I can say for sure is that it has something to do with null values.
Even the simplest example containing a null value leads to the same error:
# in the server
df=pd.DataFrame({'x': [1,2,3], 'y': [2, np.nan, 4]})
fig = px.bar(df, x='x', y='y')
It is entirely possible that there are subtle differences to how things work when comparing your local computer to the Anvil server-client relationship.
Yeah, that’s definitely a bug – regardless of data errors (I suspect some kind of weird numpy stuff), it definitely shouldn’t be failing with that error.
I’ve moved the thread to Bug Reports. Thanks for the nice example to reproduce the problem - that’ll make it a lot easier to fix!