spyder: Error debugging Plotly code in Spyder 5.4.1

F10 debugging throws NoneType Errors in latest Spyder 5.4.1: Python 3.10.9 64-bit | Qt 5.15.2 | PyQt5 5.15.7 | Windows 10 | Anaconda

Spyder Run works fine. Cut n Paste this code into Spyder Console works fine. Debug with F10 get the nonetype error below. Please suggest workaround or fix.

import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.renderers.default='svg'  # this line required for plots to show in Spyder Plots panel

df = pd.DataFrame([
    dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28'),
    dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15'),
    dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30')
])

fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task")
fig.update_yaxes(autorange="reversed") # otherwise tasks are listed from the bottom up
fig.show()

And the error text:

Traceback (most recent call last):

File ~.conda\envs\python3_10\lib\site-packages\spyder_kernels\customize\spyderpdb.py:889 in run super(SpyderPdb, self).run(cmd, globals, locals)

File ~.conda\envs\python3_10\lib\bdb.py:597 in run exec(cmd, globals, locals)

File e:\onedrive\onedrive - siemens healthineers_projects\atlas (atellica refresh)\scheduling\untitled0.py:30 fig = px.timeline(df, x_start=“Start”, x_end=“Finish”, y=“Task”)

File ~.conda\envs\python3_10\lib\site-packages\plotly\express_chart_types.py:423 in timeline return make_figure(

File ~.conda\envs\python3_10\lib\site-packages\plotly\express_core.py:1988 in make_figure apply_default_cascade(args)

File ~.conda\envs\python3_10\lib\site-packages\plotly\express_core.py:931 in apply_default_cascade x[1] for x in args[“template”].layout.colorscale.sequential

AttributeError: ‘NoneType’ object has no attribute ‘layout’

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

Updated to Spyder 5.3.3 - Works fine.