Reverted to older form of 'exception' statement for compatibility with legacy python installations.
1 parent 997b487 commit 2bdd4098ac3e96a2c15d3bd8990df5b488dfaaa8
@tundra tundra authored on 1 Aug 2011
Showing 1 changed file
View
18
tren.py
PROGNAME = "tren.py"
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
 
 
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.
 
if not ProgramOptions[TESTMODE]:
 
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
 
# End of '__RenameIt()'
n = [lhs] + n
 
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
 
return OPTIONS
# And parse the command line
 
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
# we may find in the options processing below. Also, this object must