From aa25518d954767d8865d6bd9d1847507d557bc09 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 22 Nov 2012 04:39:32 +0000 Subject: [PATCH] Ignore a GError from printing. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CHANGELOG | 8 ++++++++ zenmap/zenmapGUI/Print.py | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2fe4bd978..e3611ce38 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,13 @@ # Nmap Changelog ($Id$); -*-text-*- +o [Zenmap] Removed a crashing error that could happen when canceling a + "Print to File" 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 + This bug was reported by Imre Adácsi. [David Fifield] + o [NSE] Added new fingerprints for http-enum: Sitecore, Moodle, typo3, SquirrelMail, RoundCube. [Jesper Kückelhahn] diff --git a/zenmap/zenmapGUI/Print.py b/zenmap/zenmapGUI/Print.py index 6cd449ac3..54b0021b8 100644 --- a/zenmap/zenmapGUI/Print.py +++ b/zenmap/zenmapGUI/Print.py @@ -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