downloading jpeg using python--extra bytes?
.:|:.
ng at hardlight.couk.com
Mon Apr 10 22:40:38 EDT 2000
Hi Gabriel,
> The script works, with one exception: the jpeg image has
> extra bytes in it that corrupt the file. I'm not sure exactly
> how the bytes are dispersed, but they're not all at the
> beginning or at the end.
> g = open("myjpeg.jpg","w")
I can only presume you are in an MS-DOS environment where you need to use
g = open("myjpeg.jpg","wb")
instead of
g = open("myjpeg.jpg","w")
otherwise linefeeds are converted into carriage return / linefeed pairs
(it does tell you this in the manual page for open :-)
Matt
More information about the Python-list
mailing list