Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13258 > unrolled thread

Connection reset by peer

Started by"守株待兔" <1248283536@qq.com>
First post2011-09-14 10:39 +0800
Last post2011-09-14 10:39 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Connection reset by peer "守株待兔" <1248283536@qq.com> - 2011-09-14 10:39 +0800

#13258 — Connection reset by peer

From"守株待兔" <1248283536@qq.com>
Date2011-09-14 10:39 +0800
SubjectConnection reset by peer
Message-ID<mailman.1099.1315967984.27778.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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??

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web