1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Avoid DeprecationWarning due to accessing BaseException.message

This commit is contained in:
dmiller
2019-12-19 05:25:21 +00:00
parent 260fa12cce
commit d0c61b9cbb

View File

@@ -550,9 +550,8 @@ class ScanInterface(HIGVBox):
try:
command_execution.run_scan()
except Exception, e:
text = unicode(e.message, errors='replace')
if isinstance(e, OSError):
except OSError, e:
text = unicode(e.strerror, errors='replace')
# Handle ENOENT specially.
if e.errno == errno.ENOENT:
# nmap_command_path comes from zenmapCore.NmapCommand.
@@ -586,6 +585,13 @@ class ScanInterface(HIGVBox):
warn_dialog.run()
warn_dialog.destroy()
return
except Exception, e:
warn_dialog = HIGAlertDialog(
message_format=_("Error executing command"),
secondary_text=unicode(e, errors='replace'), type=gtk.MESSAGE_ERROR)
warn_dialog.run()
warn_dialog.destroy()
return
log.debug("Running command: %s" % command_execution.command)
self.jobs.append(command_execution)