By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,166 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,166 IT Pros & Developers. It's quick & easy.

python tags on websites timeout problem

P: n/a

im trying to pull tags off a website using python ive got a few things
running that have the potential to work its just i cant get them to
becuase of certain errors?

basically i dont what to download the images and all the stuff just
the html and then work from there, i think its timing out because its
trying to downlaod the images as well which i dont what to do as this
would decrease the speed of what im trying to achieve, the URL used is
only that for an example

ive included my source and the errors



this is my source


#!/usr/bin/env python
import re
import urllib

file = urllib.urlretrieve(""
, "temp1.tmp")

# open a file
file = open("temp1.tmp","r")
text = file.readlines()

# searching the file content line by line:
keyword = re.compile(r"</a>")

for line in text:
result = (line)
if result:
print, ":", line,
and these are the errors im getting

Traceback (most recent call last):
File "", line 5, in ?
file = urllib.urlretrieve("
8&oe=UTF-8&q=rabbit" , "temp1.tmp")
File "C:\PYTHON22\lib\", line 80, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, dat
File "C:\PYTHON22\lib\", line 210, in retrieve
fp =, data)
File "C:\PYTHON22\lib\", line 178, in open
return getattr(self, name)(url)
File "C:\PYTHON22\lib\", line 292, in open_http
File "C:\PYTHON22\lib\", line 695, in endheaders
File "C:\PYTHON22\lib\", line 581, in _send_outpu
File "C:\PYTHON22\lib\", line 548, in send
File "C:\PYTHON22\lib\", line 532, in connect
raise socket.error, msg
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.