[Tutor] need help with urllib

Jmllr891@cs.com Jmllr891@cs.com
Sat, 5 Oct 2002 12:43:00 EDT


--part1_a2.2cfda600.2ad07094_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

I've recently been trying to write a script that will download images off the 
web for me (say a daily comic strip or something of that sort).

The script works perfectly fine, it downloads the image and produces no 
errors. But the image is always corrupt or something. No matter what I try to 
view it in (even a web browser) it can't be displayed.

This is my code (this one downloads the Python logo):
---------------------------------
import urllib

image = URLopener()
image.retrieve('http://www.python.org/pics/', 'pythonHi.gif')
---------------------------------

What could be wrong? My internet connection maybe?

--part1_a2.2cfda600.2ad07094_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

<HTML><FONT FACE=arial,helvetica><FONT  SIZE=2 FAMILY="FIXED" FACE="Courier New" LANG="0">I've recently been trying to write a script that will download images off the web for me (say a daily comic strip or something of that sort).<BR>
<BR>
The script works perfectly fine, it downloads the image and produces no errors. But the image is always corrupt or something. No matter what I try to view it in (even a web browser) it can't be displayed.<BR>
<BR>
This is my code (this one downloads the Python logo):<BR>
---------------------------------<BR>
import urllib<BR>
<BR>
image = URLopener()<BR>
image.retrieve('http://www.python.org/pics/', 'pythonHi.gif')<BR>
---------------------------------<BR>
<BR>
What could be wrong? My internet connection maybe?</FONT></HTML>

--part1_a2.2cfda600.2ad07094_boundary--