Pastebin

Paste #544: handle_error()

< previous paste - next paste>

Pasted by tdn

Download View as text

This code:

260     def handle_error(self, request, client_address):
261         """Handle an error gracefully.  May be overridden.
262
263         The default is to print a traceback and continue.
264
265         """
266         print '-'*40
267         print 'Exception happened during processing of request from',
268         print client_address
269         import traceback
270         traceback.print_exc() # XXX But this goes to stderr!
271         print '-'*40
272
273

Gives this output on an exception in pyOpenSSL:

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52479)
Traceback (most recent call last):
  File "SocketServer.py", line 441, in process_request
    self.finish_request(request, client_address)
  File "SocketServer.py", line 254, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "SocketServer.py", line 522, in __init__
    self.handle()
  File "BaseHTTPServer.py", line 316, in handle
    self.handle_one_request()
  File "BaseHTTPServer.py", line 299, in handle_one_request
    self.raw_requestline = self.rfile.readline()
  File "socket.py", line 331, in readline
    data = recv(1)
Error: [('SSL routines', 'SSL3_READ_BYTES', 'tlsv1 alert unknown ca'), ('SSL routines', 'SSL23_READ', 'ssl handshake failure')]
----------------------------------------


How do I extract *only* the last line:
Error: [('SSL routines', 'SSL3_READ_BYTES', 'tlsv1 alert unknown ca'), ('SSL routines', 'SSL23_READ', 'ssl handshake failure')]


Or even specific strings in this message?

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.