diff options
| author | Piet Delport <pjdelport@gmail.com> | 2013-02-22 17:31:12 +0200 |
|---|---|---|
| committer | Piet Delport <pjdelport@gmail.com> | 2013-02-22 17:31:12 +0200 |
| commit | 9533194b2fa738d83689b8645c07d7ee021f9aaf (patch) | |
| tree | 0ae0fac7ec2782672e2bfa432d0e3ac548634219 /bin/sqlformat | |
| parent | bb57edffb4b051bdd589b4953e51d512f7534716 (diff) | |
| download | sqlparse-9533194b2fa738d83689b8645c07d7ee021f9aaf.tar.gz | |
sqlformat: Fix except blocks to be Python 3 and 2.5 compatible.
Diffstat (limited to 'bin/sqlformat')
| -rwxr-xr-x | bin/sqlformat | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/sqlformat b/bin/sqlformat index dd56b2a..4b1753a 100755 --- a/bin/sqlformat +++ b/bin/sqlformat @@ -78,13 +78,15 @@ def main(): else: try: data = '\n'.join(open(args[0]).readlines()) - except OSError, err: + except OSError: + err = sys.exc_info()[1] # Python 2.5 compatibility _error('Failed to read %s: %s' % (args[0], err), exit_=1) if options.outfile: try: stream = open(options.outfile, 'w') - except OSError, err: + except OSError: + err = sys.exc_info()[1] # Python 2.5 compatibility _error('Failed to open %s: %s' % (options.outfile, err), exit_=1) else: stream = sys.stdout @@ -92,7 +94,8 @@ def main(): formatter_opts = _build_formatter_opts(options) try: formatter_opts = sqlparse.formatter.validate_options(formatter_opts) - except SQLParseError, err: + except SQLParseError: + err = sys.exc_info()[1] # Python 2.5 compatibility _error('Invalid options: %s' % err, exit_=1) stream.write(sqlparse.format(data, **formatter_opts).encode('utf-8', |
