urlretrieve() questions

Rene Lopez renx99 at gmail.com
Fri Dec 23 10:23:59 EST 2005


I'm building an app that needs to download a file from the
web.  

I'm trying to make sure I catch any issues with the download
but I've run into a problem. 

here's what I have so far:

try:
    urllib.urlretrieve(url,filename)
    print "File: ", filename, " downloaded"
except IOError:
    print "IOError File Not Found: ", url

Pretty straight forward...but what I'm finding is if the
url is pointing to a file that is not there, the server
returns a file that's a web page displaying a 404 error. 

Anyone have any recommendations for handling this? 
-- 

Rene



More information about the Python-list mailing list