Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
asgs112758yYou better tweak your parser to do things in a jiffy to avoid showing "loading icons" at all ;-)
-
ramk3198y@osmarks you could have used a library to do that loader instead....
Something like https://github.com/rasbt/pyprind could do the trick -
osmarks8668y@ramk I do not know how long querying the Internet will take, so a progress bar won't help.
-
osmarks8668y@zantekk It didn't get quite that complicated. When the page content was downloaded it joined the thread, cleared the line and did its actual work.
-
rayanon13608yOr maybe you can just print out: "Downloading page from Wikipedia..." and be done with it.
#justsaying
Related Rants
I wrote a simple Python script to split a Wikipedia page into manageable chunks. But it took a while to load, so I decided to add a loading indicator. Just a few dots appearing and disappearing. How hard could it be?
"Okay, so I just need a few dots as a loading thing."
"Right, so I suppose I'll need a separate thread for this... Better look up Python's threading again"
"So the thread is working, but it keeps printing it out on separate lines"
"Right, that should fix it ... nope."
"I should probably fix the horrible mess here"
"Hmm... maybe if I replace the weird print() calls with all those extra parameters with sys.stdout.write()..."
"Right, that kind of works, but now there's just a permanent row of dots"
"Okay, that's fixed... Ish."
Well, it works now, but there's a weird mess of two \r's and a somewhat odd loop. Oh, and there's more code for the loading indicator than for the actual functionality. This is CLI by the way.
undefined
python
whyyyyyyyy
loading indicators are hard