diff options
author | René Stadler <mail@renestadler.de> | 2011-11-16 19:45:16 +0100 |
---|---|---|
committer | René Stadler <mail@renestadler.de> | 2011-11-16 19:45:16 +0100 |
commit | 31b3e6a33e9172c8dfb1371546b7a4befba4093b (patch) | |
tree | 71043758cacec2b046a89a3abfc00ac31107ddb4 /GstDebugViewer | |
parent | f9a9ce508e472a2cdb9b2bfb950a43e8d429ca0b (diff) |
Switch to new try..except syntax
This is forward compatible to Python 3.
Diffstat (limited to 'GstDebugViewer')
-rw-r--r-- | GstDebugViewer/Common/Main.py | 6 | ||||
-rw-r--r-- | GstDebugViewer/Common/utils.py | 10 | ||||
-rw-r--r-- | GstDebugViewer/GUI/window.py | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/GstDebugViewer/Common/Main.py b/GstDebugViewer/Common/Main.py index 4fad0ee..1cb1c7e 100644 --- a/GstDebugViewer/Common/Main.py +++ b/GstDebugViewer/Common/Main.py @@ -363,7 +363,7 @@ class OptionParser (object): try: result_argv = context.parse (argv) - except gobject.GError, exc: + except gobject.GError as exc: raise OptionError (exc.message) self.__remaining_args = result_argv[1:] @@ -437,7 +437,7 @@ def _init_locale (gettext_domain = None): if Paths.locale_dir and gettext_domain is not None: try: locale.setlocale (locale.LC_ALL, "") - except locale.Error, exc: + except locale.Error as exc: from warnings import warn warn ("locale error: %s" % (exc,), RuntimeWarning, @@ -455,7 +455,7 @@ def _init_options (option_parser = None): try: option_parser.parse (sys.argv) - except OptionError, exc: + except OptionError as exc: print >> sys.stderr, exc.args[0] sys.exit (1) diff --git a/GstDebugViewer/Common/utils.py b/GstDebugViewer/Common/utils.py index c7466e7..fd60a8f 100644 --- a/GstDebugViewer/Common/utils.py +++ b/GstDebugViewer/Common/utils.py @@ -171,7 +171,7 @@ class SaveWriteFile (object): temp_filename) try: os.unlink (temp_filename) - except EnvironmentError, exc: + except EnvironmentError as exc: self.logger.warning ("deleting stale temporary file " "failed: %s", exc) @@ -190,7 +190,7 @@ class SaveWriteFile (object): if self.temp_name: try: os.rename (self.temp_name, self.target_name) - except OSError, exc: + except OSError as exc: import errno if exc.errno == errno.EEXIST: # We are probably on windows. @@ -206,7 +206,7 @@ class SaveWriteFile (object): try: os.unlink (self.temp_name) - except EnvironmentError, exc: + except EnvironmentError as exc: self.logger.warning ("deleting temporary file failed: %s", exc) self.temp_name = None @@ -301,7 +301,7 @@ class DevhelpClient (object): try: proc = FixedPopen (("devhelp",) + args, stdout = PIPE) - except OSError, exc: + except OSError as exc: self._check_os_error (exc) raise @@ -318,7 +318,7 @@ class DevhelpClient (object): try: proc = FixedPopen (("devhelp",) + args) - except OSError, exc: + except OSError as exc: self._check_os_error (exc) raise diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py index 2a82aa9..12e44ce 100644 --- a/GstDebugViewer/GUI/window.py +++ b/GstDebugViewer/GUI/window.py @@ -419,7 +419,7 @@ class Window (object): try: select_index = model.line_index_from_top (selected_index) - except IndexError, exc: + except IndexError as exc: self.logger.debug ("abs line index %i filtered out, not reselecting", selected_index) else: @@ -741,7 +741,7 @@ class Window (object): self.dispatcher = Common.Data.GSourceDispatcher () self.log_file = Data.LogFile (filename, self.dispatcher) - except EnvironmentError, exc: + except EnvironmentError as exc: try: file_size = os.path.getsize (filename) except EnvironmentError: |