diff --git a/tren.py b/tren.py index 030e514..1c4977a 100755 --- a/tren.py +++ b/tren.py @@ -9,7 +9,7 @@ BASENAME = PROGNAME.split(".py")[0] PROGENV = BASENAME.upper() INCLENV = PROGENV + "INCL" -RCSID = "$Id: tren.py,v 1.240 2010/12/30 17:42:27 tundra Exp $" +RCSID = "$Id: tren.py,v 1.241 2011/08/01 17:50:37 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -690,8 +690,8 @@ try: pathname, basename = os.path.split(fullname) stats = os.stat(fullname) - except (IOError, OSError) as e: - ErrorMsg(eFILEOPEN % (fullname, e.args[1])) + except (IOError, OSError), (errno, errstr): + ErrorMsg(eFILEOPEN % (fullname, errstr)) # Some operating systems (Windows) terminate the path with # a separator, some (Posix) do not. @@ -1276,8 +1276,8 @@ try: os.rename(fullold, fullnew) - except OSError as e: - ErrorMsg(eRENAMEFAIL % (fullold, fullnew, e.args[1])) + except OSError, (errno, errstr): + ErrorMsg(eRENAMEFAIL % (fullold, fullnew, errstr)) self.indentlevel -= 1 @@ -2067,8 +2067,8 @@ OPTIONS = OPTIONS[:i] + n + OPTIONS[i+1:] - except IOError as e: - ErrorMsg(eFILEOPEN % (inclfile, e.args[1])) + except IOError, (errno, errstr): + ErrorMsg(eFILEOPEN % (inclfile, errstr)) i += 1 @@ -2166,8 +2166,8 @@ try: opts, args = getopt.getopt(OPTIONS, OPTIONSLIST) -except getopt.GetoptError as e: - ErrorMsg(eBADARG % e.args[0]) +except getopt.GetoptError, (errmsg, badarg): + ErrorMsg(eBADARG % errmsg) # Create and populate an object with rename targets. This must be # done here because this object also stores the -r renaming requests