1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

pygettext: explicitly open files as utf-8

When running it through SSH, I couldn't open files with non-ascii chars.
This commit is contained in:
Virgil Dupras 2013-11-24 10:22:05 -05:00
parent c1cfa86ad1
commit 0b00171655

View File

@ -378,7 +378,7 @@ def main(source_files, outpath, keywords=None):
# initialize list of strings to exclude # initialize list of strings to exclude
if options.excludefilename: if options.excludefilename:
try: try:
fp = open(options.excludefilename) fp = open(options.excludefilename, encoding='utf-8')
options.toexclude = fp.readlines() options.toexclude = fp.readlines()
fp.close() fp.close()
except IOError: except IOError:
@ -392,7 +392,7 @@ def main(source_files, outpath, keywords=None):
for filename in source_files: for filename in source_files:
if options.verbose: if options.verbose:
print('Working on %s' % filename) print('Working on %s' % filename)
fp = open(filename) fp = open(filename, encoding='utf-8')
closep = 1 closep = 1
try: try:
eater.set_filename(filename) eater.set_filename(filename)
@ -408,7 +408,7 @@ def main(source_files, outpath, keywords=None):
if closep: if closep:
fp.close() fp.close()
fp = open(options.outfile, 'w') fp = open(options.outfile, 'w', encoding='utf-8')
closep = 1 closep = 1
try: try:
eater.write(fp) eater.write(fp)