Commit 1342021e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Relexed handling of decoding errors while reading all files in directory.

parent 7de9f912
......@@ -279,12 +279,18 @@ def read_parser_log(path):
def is_octopus_logfile(fname):
with open(fname) as fd:
for n, line in enumerate(fd):
if n > 20:
break
if '|0) ~ (0) |' in line: # Eyes from Octopus logo
return True
try:
with open(fname) as fd:
for n, line in enumerate(fd):
if n > 20:
break
if '|0) ~ (0) |' in line: # Eyes from Octopus logo
return True
except UnicodeDecodeError:
# ingnore files that cannot be decoded, there are not the files
# we are looking for
pass
return False
......@@ -631,4 +637,4 @@ if __name__ == '__main__':
fname = sys.argv[1]
logfname = 'parse.log'
with open(logfname, 'w') as fd:
parse(fname, fd)
\ No newline at end of file
parse(fname, fd)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment