Closed vmharvey closed 4 weeks ago
Thanks a lot @vmharvey
I'll also make a fix for the other issue, or do you already have a solution?
I'll also make a fix for the other issue, or do you already have a solution?
All good! I was considering preparing a fix, but didn't have one ready to go. Perfectly happy to see that you got to it first :D
If a non-eventio file is opened (either a file not in the expected formats, or an empty file such as caused by a failed run of sim_telarray), an exception is raised if
close()
is called on theEventIOFile
object. This happens automatically if the variable goes out of scope, such as in the common operation of a loop over input files.Example
Output:
Fortunately in this case, the exception isn't considered fatal. But it is still noisy and can be fixed by checking the status of
_filehandle
before operating on it.Other notes
Incidentally, in the case of empty files, instead an opaque
IndexError
is raised by the method that attempts to read the file and discern its type. You can see this if you try/dev/null
instead of/dev/random
with this test script. But the follow-on issues are the same.