imageio / imageio-ffmpeg

FFMPEG wrapper for Python
BSD 2-Clause "Simplified" License
221 stars 50 forks source link

FIX: Close resource #41

Closed larsoner closed 3 years ago

larsoner commented 3 years ago

Clean up a resource that otherwise leads to:

  /home/larsoner/.local/lib/python3.8/site-packages/imageio/plugins/ffmpeg.py:531: ResourceWarning: unclosed file <_io.BufferedReader name=80>
    self._write_gen.close()
almarklein commented 3 years ago

Hey Eric :) Thanks for this patch!

Interesting ... I was not expecting the need to close the file when we go through so much effort to close the process :)

I'm not sure if the line you added could raise an exception under some conditions/platforms. Would you mind putting it in a try-except, just in case?

larsoner commented 3 years ago

Good to see you (virtually) again :)

Done!

almarklein commented 3 years ago

Thanks!