Connection reset by peer

守株待兔 1248283536 at qq.com
Tue Sep 13 22:39:36 EDT 2011


there is a multi-threads program  dowloading  data from yahoo,the main structure is as the following(omit something  unimportant )


class   webdata(object):
    def  __init__(self,name):
        self.jobs = Queue.Queue()
        if  x  in  name:
            self.jobs.put(x)
    def  download(self):
       try:
            weburl=self.jobs.get()
            url = weburl
            hx = httplib2.Http()
            resp, content = hx.request(url, headers=headers)               
            print
            self.jobs.task_done()
        except:
            print  url,"wrong"
            self.jobs.task_done()
   
    def  run(self):       
        for i in range(30):
                  threading.Thread(target=self.download).start()  
        self.jobs.join()
   
if  __name__=="__main__": 
     webdata('quote').run()



quote  is  a  list  which  i want to download,i was confused ,this program  can download something,
can't download something,
when i cancel  try,except , i get the output:
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1436, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1188, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1171, in _conn_request
    content = response.read()
  File "/usr/lib/python2.7/httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "/usr/lib/python2.7/httplib.py", line 590, in _read_chunked
    value.append(self._safe_read(chunk_left))
  File "/usr/lib/python2.7/httplib.py", line 647, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/usr/lib/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
error: [Errno 104] Connection reset by peer

i  want to know,  my  computer(client)  reset  it  ,or  the yahoo (server)  reset it ,what is the peer??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110914/34c5f526/attachment.html>


More information about the Python-list mailing list