diff options
author | jquast <contact@jeffquast.com> | 2014-06-29 01:11:38 -0700 |
---|---|---|
committer | jquast <contact@jeffquast.com> | 2014-06-29 01:11:38 -0700 |
commit | e47d0004a4eb6cb57af8769ba2624ea64bca8335 (patch) | |
tree | 348f12c78c6327e83899d4a3363a0a5f3a475c6c | |
parent | c74b8c0a179fcf2fda532a5f87d4980b18d14154 (diff) | |
download | blessings-e47d0004a4eb6cb57af8769ba2624ea64bca8335.tar.gz |
except Exception, err -> Exception as err
-rw-r--r-- | blessed/formatters.py | 4 | ||||
-rw-r--r-- | blessed/terminal.py | 2 | ||||
-rw-r--r-- | blessed/tests/test_core.py | 4 | ||||
-rw-r--r-- | blessed/tests/test_formatters.py | 4 | ||||
-rw-r--r-- | blessed/tests/test_wrap.py | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/blessed/formatters.py b/blessed/formatters.py index 1af6471..f0733d2 100644 --- a/blessed/formatters.py +++ b/blessed/formatters.py @@ -53,7 +53,7 @@ class ParameterizingString(unicode): # concats work. attr = curses.tparm(self.encode('latin1'), *args).decode('latin1') return FormattingString(attr, self._normal) - except TypeError, err: + except TypeError as err: # If the first non-int (i.e. incorrect) arg was a string, suggest # something intelligent: if len(args) and isinstance(args[0], basestring): @@ -65,7 +65,7 @@ class ParameterizingString(unicode): # Somebody passed a non-string; I don't feel confident # guessing what they were trying to do. raise - except Exception, err: + except Exception as err: # ignore 'tparm() returned NULL', you won't get any styling, # even if does_styling is True. This happens on win32 platforms # with http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses installed diff --git a/blessed/terminal.py b/blessed/terminal.py index c3b1fe7..3d6179a 100644 --- a/blessed/terminal.py +++ b/blessed/terminal.py @@ -203,7 +203,7 @@ class Terminal(object): try: self._keyboard_decoder = codecs.getincrementaldecoder( self._encoding)() - except LookupError, err: + except LookupError as err: warnings.warn('%s, fallback to ASCII for keyboard.' % (err,)) self._encoding = 'ascii' self._keyboard_decoder = codecs.getincrementaldecoder( diff --git a/blessed/tests/test_core.py b/blessed/tests/test_core.py index 72988c2..8cfe281 100644 --- a/blessed/tests/test_core.py +++ b/blessed/tests/test_core.py @@ -230,7 +230,7 @@ def test_missing_ordereddict_uses_module(monkeypatch): try: imp.reload(blessed.keyboard) - except ImportError, err: + except ImportError as err: assert err.args[0] in ("No module named ordereddict", # py2 "No module named 'ordereddict'") # py3 sys.modules['ordereddict'] = mock.Mock() @@ -255,7 +255,7 @@ def test_python3_2_raises_exception(monkeypatch): try: imp.reload(blessed) - except ImportError, err: + except ImportError as err: assert err.args[0] == ( 'Blessed needs Python 3.2.3 or greater for Python 3 ' 'support due to http://bugs.python.org/issue10570.') diff --git a/blessed/tests/test_formatters.py b/blessed/tests/test_formatters.py index 15a18b9..68af2e9 100644 --- a/blessed/tests/test_formatters.py +++ b/blessed/tests/test_formatters.py @@ -85,7 +85,7 @@ def test_parameterizing_string_type_error(monkeypatch): try: pstr('XYZ') assert False, "previous call should have raised TypeError" - except TypeError, err: + except TypeError as err: assert (err.args[0] == ( # py3x "A native or nonexistent capability template, " "'cap-name' received invalid argument ('XYZ',): " @@ -101,7 +101,7 @@ def test_parameterizing_string_type_error(monkeypatch): try: pstr(0) assert False, "previous call should have raised TypeError" - except TypeError, err: + except TypeError as err: assert err.args[0] == "custom_err" diff --git a/blessed/tests/test_wrap.py b/blessed/tests/test_wrap.py index 3d18f1d..d15073e 100644 --- a/blessed/tests/test_wrap.py +++ b/blessed/tests/test_wrap.py @@ -24,7 +24,7 @@ def test_SequenceWrapper_invalid_width(): t = TestTerminal() try: my_wrapped = t.wrap(u'------- -------------', WIDTH) - except ValueError, err: + except ValueError as err: assert err.args[0] == ( "invalid width %r(%s) (must be integer > 0)" % ( WIDTH, type(WIDTH))) |