summaryrefslogtreecommitdiff
path: root/sqlparse/cli.py
diff options
context:
space:
mode:
authorVik <vmuriart@gmail.com>2016-09-12 00:14:01 -0700
committerGitHub <noreply@github.com>2016-09-12 00:14:01 -0700
commit47fef6b7cb1fa8edd83dd31eb73aaf3c9afff086 (patch)
treecda75d04543a02e20bf04ab01c8dfc5e670a269d /sqlparse/cli.py
parent791a3312a247670cdeed61e52e8ca449dbb27afa (diff)
parent843499915e91e0ee324a0407c78ac6f570806370 (diff)
downloadsqlparse-47fef6b7cb1fa8edd83dd31eb73aaf3c9afff086.tar.gz
Merge pull request #287 from phdru/master
Convert string literals to unicode using u() for Py27
Diffstat (limited to 'sqlparse/cli.py')
-rwxr-xr-x[-rw-r--r--]sqlparse/cli.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/cli.py b/sqlparse/cli.py
index 80d547d..c329fdb 100644..100755
--- a/sqlparse/cli.py
+++ b/sqlparse/cli.py
@@ -123,7 +123,7 @@ def create_parser():
def _error(msg):
"""Print msg and optionally exit with return code exit_."""
- sys.stderr.write('[ERROR] {0}\n'.format(msg))
+ sys.stderr.write(u'[ERROR] {0}\n'.format(msg))
return 1
@@ -138,13 +138,14 @@ def main(args=None):
# TODO: Needs to deal with encoding
data = ''.join(open(args.filename).readlines())
except IOError as e:
- return _error('Failed to read {0}: {1}'.format(args.filename, e))
+ return _error(
+ u'Failed to read {0}: {1}'.format(args.filename, e))
if args.outfile:
try:
stream = open(args.outfile, 'w')
except IOError as e:
- return _error('Failed to open {0}: {1}'.format(args.outfile, e))
+ return _error(u'Failed to open {0}: {1}'.format(args.outfile, e))
else:
stream = sys.stdout
@@ -152,7 +153,7 @@ def main(args=None):
try:
formatter_opts = sqlparse.formatter.validate_options(formatter_opts)
except SQLParseError as e:
- return _error('Invalid options: {0}'.format(e))
+ return _error(u'Invalid options: {0}'.format(e))
s = sqlparse.format(data, **formatter_opts)
if PY2: