How to overcome the incomplete download with urllib.urlretrieve ?

James Yu cyu021 at gmail.com
Mon Feb 18 07:32:26 EST 2008


This is part of my code that invokes urllib.urlretrieve:

> for i in link2Visit:
>     localName = i.split('/')
>     i = i.replace(' ', '%20')
>     tgtPath = ['d:\\', 'work', 'python', 'grab_n_view']
>     localPath = ''
>     for j in tgtPath:
>         localPath = os.path.join(localPath, j)
>     localPath = os.path.join(localPath, localName[-1])
>     info = urllib.urlretrieve(i, localPath)
>
link2Visit stores the url to some photos.
After the script finishes running, I got a pile of incomplete JPG files,
each takes only 413 bytes of my disk space.
Did I miss something before using urllib.urlretrieve ?

-- 
This is a UTF-8 formatted mail
-----------------------------------------------
James C.-C.Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080218/d3ea993f/attachment.html>


More information about the Python-list mailing list