Home > Enterprise >  Can't get stqdm() to work in a for loop in a streamlit app
Can't get stqdm() to work in a for loop in a streamlit app

Time:01-13

I've been trying to incorporate the stqdm status bar enter image description here

CodePudding user response:

From my understanding of the current script, this has nothing to do with stqdm or even streamlit.

You might have a typo that makes you iterate over the index of the list instead of its elements. Replace range(len(recipes)) with recipes or replace the name of the index with index and go with recipes[index].

You should probably be able to reproduce this with the code below in a script ran directly with python.

from recipe_scrapers import scrape_me

recipes = ["https://www.allrecipes.com/recipe/158968/spinach-and-feta-turkey-burgers/"]

# You should rather do: `for recipe in stqdm(recipes):`
for recipe in range(len(recipes)):
   scrape_me(recipe)

On another note, you might have been able to find this by yourself by trying to produce a more minimal example.

  • Related