Open juhaj opened 3 years ago
Forgot to mention: the culprit is the call to stream.flush()
in the function stream_close
in mmalobj.py
, line 371:
def close_stream(stream, opened):
"""
If *opened* is ``True``, then the ``close`` method of *stream* will be
called. Otherwise, the function will attempt to call the ``flush`` method
on *stream* (if one exists). This function essentially takes the output
of :func:`open_stream` and finalizes the result.
"""
if opened:
stream.close()
else:
try:
stream.flush()
except AttributeError:
pass
I don't know if it would be safe to just add ValueError
to the except
statement or whether it would be better to simply check we have already closed it. (But why have we?)
The context
__exit__
methods ofPiCamera
andPiRGBAnalysis
try to close the output file twice when the latter is inside the scope of the former and an exception was raised inside the inner with. Reproduce with:Workaround is to not use the context manager of either
PiCamera
orPiRGBAnalysis
, with the obvious downsides.