From 03d68c0d2663796aaaf67dac0308522b34c92a97 Mon Sep 17 00:00:00 2001 From: js Date: Sun, 8 Jun 2008 10:19:26 +0000 Subject: [PATCH] Be more specific on excepts. --- src/common/dbus_support.py | 2 +- src/common/helpers.py | 4 ++-- src/gajim.py | 5 +++-- src/roster_window.py | 4 ++-- src/statusicon.py | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/dbus_support.py b/src/common/dbus_support.py index 0336e84b2..b5998d2f4 100644 --- a/src/common/dbus_support.py +++ b/src/common/dbus_support.py @@ -32,7 +32,7 @@ try: try: import osx.dbus osx.dbus.load(True) - except: + except ImportError: pass import dbus import dbus.service diff --git a/src/common/helpers.py b/src/common/helpers.py index 87c98e54f..d99639e4c 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -55,7 +55,7 @@ except ImportError: try: from osx import nsapp -except: +except ImportError: pass try: @@ -574,7 +574,7 @@ def play_sound_file(path_to_soundfile): if sys.platform == 'darwin': try: nsapp.playFile(path_to_soundfile) - except: + except NameError: pass elif os.name == 'nt': try: diff --git a/src/gajim.py b/src/gajim.py index 8af719abc..f3cf99f99 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -143,6 +143,7 @@ try: except Warning, msg: if str(msg) == 'could not open display': if sys.platform == 'darwin': + # TODO: This starts also xterm by default. Find a better way os.system('/Applications/Utilities/X11.app/Contents/MacOS/X11 &') try: import gtk @@ -611,7 +612,7 @@ def on_exit(): try: import osx osx.shutdown() - except: + except ImportError: pass import atexit @@ -3475,7 +3476,7 @@ if __name__ == '__main__': try: import osx osx.init() - except: + except ImportError: pass Interface() diff --git a/src/roster_window.py b/src/roster_window.py index 00b3351a4..a8d947801 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -63,7 +63,7 @@ from lastfm_track_listener import LastFMTrackListener try: from osx import syncmenu -except: +except ImportError: pass #(icon, name, type, jid, account, editable, second pixbuf) @@ -4480,7 +4480,7 @@ class RosterWindow: if sys.platform == 'darwin': try: syncmenu.takeover_menu(self.xml.get_widget('menubar')) - except: + except NameError: pass self.actions_menu_needs_rebuild = False diff --git a/src/statusicon.py b/src/statusicon.py index ed0c02dda..c69e90fec 100644 --- a/src/statusicon.py +++ b/src/statusicon.py @@ -29,7 +29,7 @@ from common import helpers if sys.platform == 'darwin': try: import osx - except: + except ImportError: pass class StatusIcon(systray.Systray):