[Tutor] Corrupt files

Alan G alan.gauld at freenet.co.uk
Tue Aug 2 22:48:53 CEST 2005


>>I have created a program that automatically downloads some files I 
>>need.
>>It can be .zip, .jpg, .mpg or .txt. However, a lot of the time 
>>urlretrieve
>>downloads the file, gives no error, but the downloaded file is 
>>corrupted.
>>I use a simple check for the size of the file. If it is way too 
>>small, I
>>automatically remove it.

Is it possible you are downloading a binary file as a text file?
If so the EOF character may be present and this is what truncates
the file. A sign that this is the problem is if the same file
always stops after the same number of bytes.

I've never used urlretrieve but its a common problewm with ftp, and I 
assume
url is the same. Is there a flag/parameter you can set to fetch in 
binary mode?

Just guessing,

Alan G. 



More information about the Tutor mailing list