PDA

View Full Version : [SOLVED] Displaying download progress in Python


Ayuthia
August 26th, 2007, 11:54 AM
Is there a way to display the progress of wget in Python? I am calling wget via commands.getoutput, but the command does not display the progress until the command is complete. Since some of the programs might take a little time to download, I would like to be able to show the progress of the download so that the user does not think that the program is in an endless loop.

Ayuthia
August 26th, 2007, 12:09 PM
It looks like the subprocess.call (cmd, shell=True) will work for me.

Acglaphotis
August 26th, 2007, 02:54 PM
How would you call it?

Ayuthia
August 26th, 2007, 03:25 PM
I would have a function that will download a file. For example:


import subproces

def download_file():
successful_download=subprocess.call('wget -c http://mesh.dl.sourceforge.net/sourceforge/ndiswrapper/ndiswrapper-1.47.tar.gz')
return successful_download

So when download_file() gets called, it will do the wget command and display the information that wget is sending.

Hope that makes sense.

Ayuthia
August 26th, 2007, 03:27 PM
Oops. Posted twice.