Skip to content

Progress Value has invalid value [0, 100]: 101 in docs/getting_started.md #234

@kevindegila

Description

@kevindegila

When running the examples in docs/getting_started.md i encountered a Value Error in the Show Progress Section with the progress bar.
Here is the code i runned:

latest_iteration = st.empty()
bar = st.progress(0)

for i in range(101):
  # Update the progress bar with each iteration.
  latest_iteration.text('Iteration %d' % i)
  bar.progress(i + 1)
  time.sleep(0.1)

'...and now we\'re done!'

Here is the error:

ValueError: Progress Value has invalid value [0, 100]: 101
File "/home/kevin/anaconda3/envs/tf2/lib/python3.6/site-packages/streamlit/ScriptRunner.py", line 306, in _run_script exec(code, module.dict)
File "/home/kevin/Bureau/streamtest/first_app.py", line 49, in bar.progress(i + 1)
File "/home/kevin/anaconda3/envs/tf2/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 122, in wrapped_method marshall_element, delta_type, last_index)
File "/home/kevin/anaconda3/envs/tf2/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 317, in _enqueue_new_element_delta rv = marshall_element(msg.delta.new_element)
File "/home/kevin/anaconda3/envs/tf2/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 119, in marshall_element return method(dg, element, *args, **kwargs)
File "/home/kevin/anaconda3/envs/tf2/lib/python3.6/site-packages/streamlit/DeltaGenerator.py", line 1943, in progress "Progress Value has invalid value [0, 100]: %d" % value

Looks like it's because at the last iteration i = 100 . The error is raised by bar.progress(101) . I guess that what we wanted here is a progress bar with 100 iterations and not 101. I fixed the error by changing the value in range() to 100. Will submit a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions