Skip to content

Commit

Permalink
src/TermRecord: forgot, need to copen everywhere
Browse files Browse the repository at this point in the history
+ Would use `EncodedFile`---but that doesn't seem to read unicode strings!
+ Would use `FileType(... encoding=)` but that doesn't work on Python2
  • Loading branch information
theonewolf committed Feb 26, 2015
1 parent d706130 commit 4f3d6c4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/TermRecord
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def runScript(command=None):
proc = Popen(CMD, stderr=timingf)
proc.wait()

return copen(scriptfname, encoding='utf-8'), \
return copen(scriptfname, encoding='utf-8', errors='replace'), \
open(timingfname, 'r')

def runTtyrec(command=None):
Expand All @@ -110,7 +110,7 @@ def runTtyrec(command=None):

proc = Popen(CMD)
proc.wait()
return open(scriptfname, 'r')
return copen(scriptfname, encoding='utf-8', errors='replace')

def getTiming(timef):
timing = None
Expand Down Expand Up @@ -189,7 +189,7 @@ if __name__ == '__main__':
help='file to use as HTML template', required=False)
argparser.add_argument('-o', '--output-file', type=FileType('w'),
help='file to output HTML to', required=False)
argparser.add_argument('-s', '--script-file', type=FileType('r'),
argparser.add_argument('-s', '--script-file', type=str,
help='script file to parse', required=False)
argparser.add_argument('-t', '--timing-file', type=FileType('r'),
help='timing file to parse', required=False)
Expand Down Expand Up @@ -233,6 +233,8 @@ if __name__ == '__main__':
scriptf = runTtyrec(command)
else:
scriptf,timef = runScript(command)
else:
scriptf = copen(scriptf, encoding='utf-8', errors='replace')

if backend == TTYREC:
json = parseTtyrec(scriptf)
Expand Down

0 comments on commit 4f3d6c4

Please sign in to comment.