1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31: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: try:
command_execution.run_scan() command_execution.run_scan()
except Exception, e: except OSError, e:
text = unicode(e.message, errors='replace') text = unicode(e.strerror, errors='replace')
if isinstance(e, OSError):
# Handle ENOENT specially. # Handle ENOENT specially.
if e.errno == errno.ENOENT: if e.errno == errno.ENOENT:
# nmap_command_path comes from zenmapCore.NmapCommand. # nmap_command_path comes from zenmapCore.NmapCommand.
@@ -586,6 +585,13 @@ class ScanInterface(HIGVBox):
warn_dialog.run() warn_dialog.run()
warn_dialog.destroy() warn_dialog.destroy()
return 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) log.debug("Running command: %s" % command_execution.command)
self.jobs.append(command_execution) self.jobs.append(command_execution)