Fix error: open log file in text mode to avoid doing str conversion and get some bytes result

This commit is contained in:
Gregory Soutade 2021-06-04 09:10:50 +02:00
parent 937706d88d
commit f149baed70

View File

@ -788,7 +788,7 @@ class IWLA(object):
for l in _file:
# print "line " + l
groups = self.log_re.match(str(l))
groups = self.log_re.match(l)
if groups:
self._newHit(groups.groupdict(""))
@ -828,9 +828,9 @@ class FileIter(object):
raise StopIteration()
filename = self.filenames.pop(0)
if filename.endswith('gz'):
self.cur_file = gzip.open(filename, 'r')
self.cur_file = gzip.open(filename, 'rt')
else:
self.cur_file = open(filename)
self.cur_file = open(filename, 'rt')
def next(self):
l = self.cur_file.readline()