From ff61845ce23db5dcf8adc03a6c82ca8a3ae12340 Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 10 Dec 2019 20:51:56 +0000 Subject: [PATCH] Avoid encoding errors in exception handler. See #1839 --- zenmap/zenmapGUI/ScanInterface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zenmap/zenmapGUI/ScanInterface.py b/zenmap/zenmapGUI/ScanInterface.py index 706c2d748..67ecec11f 100644 --- a/zenmap/zenmapGUI/ScanInterface.py +++ b/zenmap/zenmapGUI/ScanInterface.py @@ -551,7 +551,7 @@ class ScanInterface(HIGVBox): try: command_execution.run_scan() except Exception, e: - text = unicode(e) + text = unicode(e.message, errors='replace') if isinstance(e, OSError): # Handle ENOENT specially. if e.errno == errno.ENOENT: @@ -578,6 +578,8 @@ class ScanInterface(HIGVBox): else: text += u"\n\n" + _("plus the extra directories") text += u"\n\n" + os.pathsep.join(extra_paths) + else: + text += u" (%d)" % e.errno warn_dialog = HIGAlertDialog( message_format=_("Error executing command"), secondary_text=text, type=gtk.MESSAGE_ERROR)