This problem has been driving me crazy, I just can't seem to find anything in the Python docs.

I've been working on a script, It connects to a remote server and downloads multiple RAR files as a "job", it then extracts them to the correct place.
It works, but I get this for each file:

Getting http://(url removed).com
(big delay here)
Got http://(url removed).com

You can see the problem with that, it doesn't give you an idea of how much work it's done.
I've been trying to implement a status bar, I can get the percentage by downloading the files in chunks. But I don't know how to write this to part of the screen in the way that wget would ( I would get annoyed if it kept taking new lines everytime the percentage changed).

edit: I should also add that I can't use any advanced graphics or anything, it gets ran on a linux server via ssh.


8 Years
Discussion Span
Last Post by tb808kid

I think you need to give us just a little bit more information about your code. Mindreading is not everyone's talent.


Ok, I thought it was pretty clear, I think the problem is too much information.

Cut down explanation:
How do I make python output status info the way wget does?

This is way wget outputs information:

Notice how the speed and pecentage done change without a new line, thats what I'd like to do in python.


Ah, I did happen to discover the ncurses library, I've used it with c++ and agree with you on the performance issues (can really see it if you have to work on a busy thin client network). I've been trying to figure out how wget works by looking at the source, I *think* it uses ncurses. I'll try ncurses and see how much it taxes the script. Thanks ZZucker.


In case anyone discovers this, the solution is to the use '\r', to will move the cursor the start of the line.

where [] is the cursor.

print "asdasd\r" //will give [a]sdasd

now the cursor is at the start, you car "overwrite" the line.

Just thought I'd update this for anyone else who hits this page, its really frustrating to spend hours googlng things and hitting dead ends.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.