Skip to content

Commit

Permalink
Merge pull request #282 from vmharvey/patch-1
Browse files Browse the repository at this point in the history
Fix exception when closing non-eventio files
  • Loading branch information
maxnoe authored Oct 17, 2024
2 parents 79228db + cc3be04 commit 03ae8e3
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 03ae8e3

Please sign in to comment.