Skip to content

stream.write raises error in plotly 3.1.0 #1108

Closed
@Kully

Description

@Kully

A simple streaming example that was working in Plotly 2.2 now does not work in 3.1.0+

import time
import plotly.plotly as py
from plotly.graph_objs import Data, Scatter, Stream, Bar

stream_id = '3luati1sxe'


py.plot(Data([Bar(x=[1], y=[1], stream=Stream(token=stream_id, maxpoints=60))]))

stream = py.Stream(stream_id) # Initialize a stream object
stream.open() # Open the stream

for i in range(1000):
    m = stream.write(dict(x=[i+2], y=[5]))
    print "i: ", i
    time.sleep(2)
    print "Sent"

results in the validation error

ValueError: The 'type' property of scatter is read-only

Changing m = stream.write(dict(x=[i+2], y=[5])) to m = stream.write(Bar(x=[i+2], y=[5])) bypasses the problem, allowing the script to run and print the statements. But the figure is not appending to its data, but replacing each Bar trace that is added as evidenced by the (i)plot that updates.

cc @jonmmease @tarzzz

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions