Traceback: File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.__dict__) File "/app/harshkumar-streamlit/app.py", line 102, in <module> with b == 0.6:

I am deploying app but it throws some error

Hi @Hackytes! :wave:

with b == 0.6: isn’t valid Python syntax. The with keyword in Python is used for context management, typically with files or other resources that need to be cleaned up after use.

If you’re trying to compare the value of b with 0.6, you would typically use an if statement:

if b == 0.6:
    # do something

If b is a variable that should vary with Streamlit’s interactive widgets, you might use something like this:

b = st.slider('Select a value for b', 0.0, 1.0, 0.6)

if b == 0.6:
    # do something

This would create a slider on your Streamlit app that allows the user to select a value for b, and then perform some action if b equals 0.6.

I hope this helps

Best wishes,
Charly

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.