URLLIB2 EXCEPTION

bart e_viola at libero.it
Tue Nov 19 14:45:42 EST 2002


Sometime, when I use urlopen function, happen this:

Traceback (most recent call last):
   File "<stdin>", line 2, in ?
   File "/usr/local/lib/python2.2/urllib2.py", line 138, in urlopen
     return _opener.open(url, data)
   File "/usr/local/lib/python2.2/urllib2.py", line 322, in open
     '_open', req)
   File "/usr/local/lib/python2.2/urllib2.py", line 301, in _call_chain
     result = func(*args)
   File "/usr/local/lib/python2.2/urllib2.py", line 790, in http_open
     return self.do_open(httplib.HTTP, req)
   File "/usr/local/lib/python2.2/urllib2.py", line 784, in do_open
     return self.parent.error('http', req, fp, code, msg, hdrs)
   File "/usr/local/lib/python2.2/urllib2.py", line 342, in error
     result = self._call_chain(*args)
   File "/usr/local/lib/python2.2/urllib2.py", line 301, in _call_chain
     result = func(*args)
   File "/usr/local/lib/python2.2/urllib2.py", line 434, in http_error_302
     return self.parent.open(new)
   File "/usr/local/lib/python2.2/urllib2.py", line 322, in open
     '_open', req)
   File "/usr/local/lib/python2.2/urllib2.py", line 301, in _call_chain
     result = func(*args)
   File "/usr/local/lib/python2.2/urllib2.py", line 790, in http_open
     return self.do_open(httplib.HTTP, req)
   File "/usr/local/lib/python2.2/urllib2.py", line 779, in do_open
     code, msg, hdrs = h.getreply()
   File "/usr/local/lib/python2.2/httplib.py", line 1009, in getreply
     response = self._conn.getresponse()
   File "/usr/local/lib/python2.2/httplib.py", line 760, in getresponse
     response.begin()
   File "/usr/local/lib/python2.2/httplib.py", line 269, in begin
     version, status, reason = self._read_status()
   File "/usr/local/lib/python2.2/httplib.py", line 231, in _read_status
     line = self.fp.readline()
IOError: [Errno 104] Connection reset by peer


I understood that connection can be reseted but I managed this exception 
cases: HTTPError and URLError. I don't know another exception that can 
be generate in urllib2. Besides IOError exception doesn't present inside 
urllib2. What can I do to resolve my problem? Where I can found (web 
site, manual and other) a solution?

Thanks to help me...

                                                     - Ennio -




More information about the Python-list mailing list