Skip to content

Number_Input Errors with mismatched types #2783

@CFrez

Description

@CFrez

I am not sure if this is something that needs to be resolved simply in the documentation, that all types are required to match, or if it should/could be accommodated through the backend.

Steps to reproduce

Value Step mismatch

Code snippet:

stiffness = st.number_input(
    'stiffness, k, kip/in',
    value = 406.74,
    step = 1
    )   

Error returned:

StreamlitAPIException: All numerical arguments must be of the same type. value has float type. 
min_value has NoneType type. max_value has NoneType type. step has int type.

If the value and step match, then everything runs fine and no error is thrown with regards to min and max value.

Step mismatch doesn't show up in error message

Code with everything but step matching:

stiffness = st.number_input(
    'stiffness, k, kip/in',
    min_value = 2.1,
    max_value = 1000.01,
    value = 406.74,
    step = 1
    )

Error returned:

StreamlitAPIException: All arguments must be of the same type. value has float type. min_value 
has float type. max_value has float type.

Debug info

  • Streamlit version: 0.76.0
  • Python version: 2.7.16 (now I have to find why it used this.... but not your problem)
  • PyEnv version: 1.2.22
  • PipEnv used for virtual environment
  • OS version: 11.2
  • Firefox Developer version: 86.0b5

Side Note

I am not sure if it just my use case, but for me it I am more likely to have a value assigned over the min or max. If this is the typical use case, it might be worth considering the breaking change of switching value to before min, max. Which is only a factor if not using assignment of the parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomers to the codebasetype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions