summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-11-25 18:22:30 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-11-25 18:22:30 +1300
commitb1ca3bcbc0ce150d99b94d9c4b84de1b73693cb9 (patch)
treec629c4f2d3f3040fb057a61dcaad7877764a0e9c
parentf28cc4ffb9fecc63210ed0bca52077fbcc9612d5 (diff)
downloadsubunit-b1ca3bcbc0ce150d99b94d9c4b84de1b73693cb9.tar.gz
Open files in binary mode.
-rw-r--r--python/subunit/_output.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/subunit/_output.py b/python/subunit/_output.py
index 32d5110..8be2ca8 100644
--- a/python/subunit/_output.py
+++ b/python/subunit/_output.py
@@ -134,7 +134,7 @@ def parse_arguments(args=None, ParserClass=OptionParser):
options.attach_file = sys.stdin
else:
try:
- options.attach_file = open(options.attach_file)
+ options.attach_file = open(options.attach_file, 'rb')
except IOError as e:
parser.error("Cannot open %s (%s)" % (options.attach_file, e.strerror))
if options.tags and not options.action:
@@ -166,8 +166,8 @@ def generate_stream_results(args, output_writer):
if args.attach_file:
reader = partial(args.attach_file.read, _CHUNK_SIZE)
- this_file_hunk = reader().encode('utf8')
- next_file_hunk = reader().encode('utf8')
+ this_file_hunk = reader()
+ next_file_hunk = reader()
is_first_packet = True
is_last_packet = False
@@ -202,7 +202,7 @@ def generate_stream_results(args, output_writer):
is_last_packet = True
else:
this_file_hunk = next_file_hunk
- next_file_hunk = reader().encode('utf8')
+ next_file_hunk = reader()
else:
is_last_packet = True