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.

Thanks.

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:
http://users.ugent.be/~bpuype/wget/wget-screen.png

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

BTW, updating the display screen continuously will be the slowest part of your program.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.