Skip to content

Commit

Permalink
file reading mode changed to binary
Browse files Browse the repository at this point in the history
  • Loading branch information
ph4r05 committed Nov 11, 2017
1 parent aa02aaa commit 3a88db8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion booltest/booltest_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def load_input_objects(self):
:return:
"""
for file in self.args.files:
io = common.FileInputObject(fname=file)
io = common.FileInputObject(fname=file, fmode='rb')
io.check()
self.input_objects.append(io)

Expand Down
10 changes: 9 additions & 1 deletion booltest/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,21 @@ class FileInputObject(InputObject):
File input object - reading from the file
"""
def __init__(self, fname, *args, **kwargs):
"""
File reading input object
:param fname:
:param fmode:
:param args:
:param kwargs:
"""
super(FileInputObject, self).__init__(*args, **kwargs)
self.fname = fname
self.fmode = kwargs.get('fmode', 'r')
self.fh = None

def __enter__(self):
super(FileInputObject, self).__enter__()
self.fh = open(self.fname, 'r')
self.fh = open(self.fname, self.fmode)

def __exit__(self, exc_type, exc_val, exc_tb):
super(FileInputObject, self).__exit__(exc_type, exc_val, exc_tb)
Expand Down

0 comments on commit 3a88db8

Please sign in to comment.