diff options
author | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-01-10 16:19:56 (GMT) |
commit | b940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch) | |
tree | 0b9ea19eba1e665dac95126c3140ac2bc36326ad /Tools/webchecker | |
parent | 893523e80a2003d4a630aafb84ba016e0070cbbd (diff) | |
download | cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2 |
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V"
(b) V is now limited to a simple name (local variable)
(c) V is now deleted at the end of the except block
Diffstat (limited to 'Tools/webchecker')
-rwxr-xr-x | Tools/webchecker/wcgui.py | 2 | ||||
-rwxr-xr-x | Tools/webchecker/webchecker.py | 10 | ||||
-rwxr-xr-x | Tools/webchecker/websucker.py | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Tools/webchecker/wcgui.py b/Tools/webchecker/wcgui.py index 96aed0a..c6e216c 100755 --- a/Tools/webchecker/wcgui.py +++ b/Tools/webchecker/wcgui.py @@ -74,7 +74,7 @@ if sys.platform == 'mac': def main(): try: opts, args = getopt.getopt(sys.argv[1:], 't:m:qva') - except getopt.error, msg: + except getopt.error as msg: sys.stdout = sys.stderr print msg print __doc__%vars(webchecker) diff --git a/Tools/webchecker/webchecker.py b/Tools/webchecker/webchecker.py index 923e8e6..10e93c7 100755 --- a/Tools/webchecker/webchecker.py +++ b/Tools/webchecker/webchecker.py @@ -153,7 +153,7 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'Rd:m:nqr:t:vxa') - except getopt.error, msg: + except getopt.error as msg: sys.stdout = sys.stderr print msg print __doc__%globals() @@ -335,7 +335,7 @@ class Checker: rp.set_url(url) try: rp.read() - except (OSError, IOError), msg: + except (OSError, IOError) as msg: self.note(1, "I/O error parsing %s: %s", url, msg) def run(self): @@ -402,7 +402,7 @@ class Checker: return try: page = self.getpage(url_pair) - except sgmllib.SGMLParseError, msg: + except sgmllib.SGMLParseError as msg: msg = self.sanitize(msg) self.note(0, "Error parsing %s: %s", self.format_url(url_pair), msg) @@ -541,7 +541,7 @@ class Checker: url, fragment = url_pair try: return self.urlopener.open(url) - except (OSError, IOError), msg: + except (OSError, IOError) as msg: msg = self.sanitize(msg) self.note(0, "Error %s", msg) if self.verbose > 0: @@ -759,7 +759,7 @@ class MyURLopener(urllib.FancyURLopener): return self.open_file(url + "index.html") try: names = os.listdir(path) - except os.error, msg: + except os.error as msg: exc_type, exc_value, exc_tb = sys.exc_info() raise IOError, msg, exc_tb names.sort() diff --git a/Tools/webchecker/websucker.py b/Tools/webchecker/websucker.py index ef2fa44..239cb52 100755 --- a/Tools/webchecker/websucker.py +++ b/Tools/webchecker/websucker.py @@ -21,7 +21,7 @@ def main(): verbose = webchecker.VERBOSE try: opts, args = getopt.getopt(sys.argv[1:], "qv") - except getopt.error, msg: + except getopt.error as msg: print msg print "usage:", sys.argv[0], "[-qv] ... [rooturl] ..." return 2 @@ -83,7 +83,7 @@ class Sucker(webchecker.Checker): f.write(text) f.close() self.message("saved %s", path) - except IOError, msg: + except IOError as msg: self.message("didn't save %s: %s", path, str(msg)) def savefilename(self, url): |