From 37d15af8bf81d3ba418507923fa36e6643fbdd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Nizio?= Date: Thu, 4 Aug 2016 01:30:22 +0200 Subject: [PATCH] [entropy.client] fixes to exception handler - correct negated logic in EPIPE hanling - correct ENOSPC handling (it's IOError, but OSError was catched) - support Python 3.3+ which got reworked exceptions --- client/solo/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/solo/main.py b/client/solo/main.py index 070ab9241..4939734e4 100644 --- a/client/solo/main.py +++ b/client/solo/main.py @@ -55,8 +55,8 @@ def handle_exception(exc_class, exc_instance, exc_tb): if exc_class is SystemExit: return - if exc_class is IOError: - if exc_instance.errno != errno.EPIPE: + if issubclass(exc_class, IOError): # in Python 3.3+ it's BrokenPipeError + if exc_instance.errno == errno.EPIPE: return if exc_class is KeyboardInterrupt: @@ -70,7 +70,7 @@ def handle_exception(exc_class, exc_instance, exc_tb): entropy.tools.print_exception(tb_data = exc_tb) pdb.set_trace() - if exc_class is OSError: + if exc_class in (IOError, OSError): if exc_instance.errno == errno.ENOSPC: print_generic(t_back) _text.output(