Threads and Progress Bar
Bryan Olson
fakeaddress at nowhere.org
Sat Sep 2 13:22:24 EDT 2006
Ritesh Raj Sarraf wrote:
[...]
> Here's the function, download_from_web() which calls the progress bar:
> main.py
> def download_from_web(sUrl, sFile, sSourceDir, checksum):
[...]
> temp = urllib2.urlopen(sUrl)
> headers = temp.info()
> size = int(headers['Content-Length'])
> data = open(sFile,'wb')
Incidentally, not all HTTP responses with bodies have
a 'Content-Length' header.
--
--Bryan
More information about the Python-list
mailing list