Skip to content

Commit

Permalink
DFReader: is_text_log should return false if binary
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 committed Jan 8, 2024
1 parent 69485b0 commit 58e3490
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,10 @@ def make_format_msgbuf(self, fmt):
def DFReader_is_text_log(filename):
'''return True if a file appears to be a valid text log'''
with open(filename, 'r') as f:
ret = (f.read(8000).find('FMT,') != -1)

try:
ret = (f.read(8000).find('FMT,') != -1)
except UnicodeDecodeError:
ret = False
return ret


Expand Down

0 comments on commit 58e3490

Please sign in to comment.