[Pythonmac-SIG] urlopen() question
tom smith
tom@othermedia.com
Thu, 07 Dec 2000 17:04:14 +0000
Jack kindly wrote me a bit of code to REALLY get a urls' data for me...along
the lines of...
def read_url(url, the_file=None):
u = urllib.urlopen(str(url))
rv = ''
newdata = u.read()
while newdata:
rv = rv + newdata
try:
newdata = u.read()
except:
raise
u.close()
return rv
...the only problem is is that I keep getting "socket not connected errors"
which I can't catch. I need my program to keep running, so if a socket
doesn't connect, I'll try again later
any ideas?
thanks
tom