import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'hcaw:e:', ['help', 'context', 'ascii', 'width=', 'encoding=', ])
-except getopt.GetoptError, e:
+except getopt.GetoptError as e:
print >>sys.stderr, 'texml: Can\'t parse command line: %s' % e
print >>sys.stderr, usage
sys.exit(2)
if '-' == outfile:
f = sys.stdout
else:
- f = file(outfile, 'wb')
+ f = open(outfile, 'wb')
#
# An error handler
try:
Texml.processor.process(infile, f, encoding, width, always_ascii, use_context)
-except Exception, msg:
+except Exception as msg:
msg = 'texml: %s\n' % (str(msg))
quit(msg)