add_vline fails in batch mode

Open
#4,742 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
plotly, python

Research direction

Start with the batch_update context and add_vline example, then inspect plotly/basedatatypes.py around line 3995. Compare the failing batch-mode path with the working direct call and reproduce the TypeError using the versions in the report. Done means add_vline works inside fig.batch_update() without raising while preserving the existing direct-call behavior.

Written by the indexing model from the issue text.

Description

bug P3

I am using plotly 5.24.0 with python 3.10.12 in a vs-code interactive window.

The following example raises TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str' in [...]/site-packages/plotly/basedatatypes.py:3995

import plotly.graph_objects as go

fig = go.Figure()

with fig.batch_update():
    fig.add_vline(1)

The same example without batch mode works fine:

import plotly.graph_objects as go

fig = go.Figure()

fig.add_vline(1)
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from plotly/plotly.py

All issues in plotly/plotly.py

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.