Plotly go.Layout strange errors


#1

Hi All,
I have a python notebook script last successful run 15 days ago. The scripts weren’t change at all but failed today due to the following error happened in the go.Layout. It was very weird error never happened before. Can you please help? Thank you very much.

#layout of plot
layout = go.Layout(
    title = 'Plot Title',
    titlefont=dict(
            size=title_font_size,
            color='#000000'
        ),
    xaxis = dict(
        title = 'x title',
        type='log',
        autorange=True,
        titlefont=dict(
            size=axis_font_size,
            color='#000000'
        ),
        tickfont=dict(
            size=tick_font_size,
            color='#000000'
        )
    ),
    yaxis = dict(
        title = 'y title',
        range = [0, 100],
        type='log',
        autorange=True,
        titlefont=dict(
            size=axis_font_size,
            color='#000000'
        ),
        tickfont=dict(
            size=tick_font_size,
            color='#000000'
        )
    ),
    legend=dict(
        font=dict(
            size=legend_size,
            color='#000'
        )
    ),
)

The error message was:
PlotlyDictValueError: ‘title’ has invalid value inside ‘yaxis’

Path To Error: [‘yaxis’][‘title’]

Current path: [‘yaxis’]
Current parent object_names: [‘layout’]

With the current parents, ‘title’ can be used as follows:

Under (‘figure’, ‘layout’, ‘scene’, ‘yaxis’):

editType: plot
role: object

Under (‘figure’, ‘layout’, ‘yaxis’):

editType: ticks
role: object

Python version: 2.7.12 (under both Ubuntu and Windows 10 have same error)


#3

I’m experiencing the exact same error and like you it has randomly started about 2 weeks ago.
Here is the error as it appears:

<class 'plotly.exceptions.PlotlyDictValueError'>: 'title' has invalid value inside 'yaxis' Path To Error: ['yaxis']['title'] Current path: ['yaxis'] Current parent object_names: ['layout'] With the current parents, 'title' can be used as follows: Under ('figure', 'layout', 'scene', 'yaxis'): editType: plot role: object Under ('figure', 'layout', 'yaxis'): editType: ticks role: object 
  args = ("'title' has invalid value inside 'yaxis'",) 
  message = "'title' has invalid value inside 'yaxis'" 
  notes = ["Current path: ['yaxis']\nCurrent parent object_na...yaxis'):\n\n editType: ticks\n role: object\n\n\n"] 
  path = ['yaxis', 'title'] 
  plain_message = "'title' has invalid value inside 'yaxis'"

Hopefully someone can advise.

Kind Regards,
Luke


#4

Best for #api:python


#5

I also encountered this problem, and was able to trigger it using sample code from the plotly documentation…
(https://plot.ly/python/offline/ - “static image export”)

I found a workaround of sorts: disabling validation. the labels all still work, so it seems like someone has broken the validation logic in a recent update.

This notebook shows the error isolated to a tiny bit of sample code, and identical code with the workaround of validate=False, which works.

Note however that validation=False only seems to do anything when you pass in raw dicts, like the sample code does; it does nothing if you’re trying to use the actual datatypes like go.Layout; so I’ve had to rewrite my code to just use dictionaries for all the configuration.


#6

I just encountered exactly this problem (Python 3.5 running on Ubuntu 14). My script has been using Plotly offline 1.9.6 for a few years, and suddenly it’s broken with the same error message.

I resolved the issue by upgrading to the latest version of Plotly’s Python package (version 3.5.0). I didn’t have to make any code change.

However, can anyone explain why Plotly offline broke in the first place? I have not even touched my script or the Ubuntu server that runs it for many months.