Skip to content

Commit

Permalink
Fix exception raised by non-eventio files
Browse files Browse the repository at this point in the history
  • Loading branch information
vmharvey authored Oct 17, 2024
1 parent 79228db commit cc3be04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/eventio/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, path, zcat=True):
self.read_process = None
self.zstd = False
self.next = None
self._filehandle = None

if not is_eventio(path):
raise ValueError('File {} is not an eventio file'.format(path))
Expand Down Expand Up @@ -151,7 +152,8 @@ def close(self):
self.read_process.stderr.close()
self.read_process.wait(timeout=1)

self._filehandle.close()
if self._filehandle is not None:
self._filehandle.close()

def __del__(self):
self.close()
Expand Down

0 comments on commit cc3be04

Please sign in to comment.