1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Ignore a GError from printing.

This strange error happens when canceling a "Print to File" operation on
Windows:

Traceback (most recent call last):
  File "zenmapGUI\MainWindow.pyo", line 831, in _print_cb
  File "zenmapGUI\Print.pyo", line 156, in run_print_operation
GError: Error from StartDoc

The web seems mostly silent on this error, and I can't guess at the
cause. Let's ignore the error as it seems to be harmless.

Reported by Imre Adácsi.
http://seclists.org/nmap-dev/2012/q4/161
This commit is contained in:
david
2012-11-22 04:39:32 +00:00
parent 06c190da84
commit aa25518d95
2 changed files with 16 additions and 1 deletions

View File

@@ -103,6 +103,7 @@
# else. This might go in a separate Print Setup dialog.
import gtk
import gobject
import pango
MONOSPACE_FONT_DESC = pango.FontDescription("Monospace 12")
@@ -153,4 +154,10 @@ def run_print_operation(inventory, entry):
state = PrintState(inventory, entry)
op.connect("begin-print", state.begin_print)
op.connect("draw-page", state.draw_page)
op.run(gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG, None)
try:
op.run(gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG, None)
except gobject.GError:
# Canceling the print operation can result in the error
# GError: Error from StartDoc
# http://seclists.org/nmap-dev/2012/q4/161
pass