From 5c26fee853dd96a071d86d42765a3e6445a94a4a Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Fri, 5 Feb 2010 08:58:47 -0500 Subject: [PATCH] handle mysql error on close if connection was timed out --- pyfpdb/fpdb.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 5bef3503..7a000981 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -802,8 +802,11 @@ class fpdb: # TODO: can we get some / all of the stuff done in this function to execute on any kind of abort? print "Quitting normally" # TODO: check if current settings differ from profile, if so offer to save or abort - if self.db is not None and self.db.connected: - self.db.disconnect() + try: + if self.db is not None and self.db.connected: + self.db.disconnect() + except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected + pass self.statusIcon.set_visible(False) gtk.main_quit()