Skip to content

Video editing with Python

fix for os calls through Popen that are not closed

Michael Gyglif612a4592623
diff --git a/moviepy/audio/io/AudioFileClip.py b/moviepy/audio/io/AudioFileClip.py
index b627c14c..5c904247 100644
--- a/moviepy/audio/io/AudioFileClip.py
+++ b/moviepy/audio/io/AudioFileClip.py
@@ -77,3 +77,10 @@ class AudioFileClip(AudioClip):
to the audio file. Use copy when you have different clips
watching the audio file at different times. """
return AudioFileClip(self.filename,self.buffersize)
+
+ def __del__(self):
+ """ Close/delete the internal reader. """
+ try:
+ del self.reader
+ except AttributeError:
+ pass
diff --git a/moviepy/video/io/VideoFileClip.py b/moviepy/video/io/VideoFileClip.py
index 70fc8c13..552c03d8 100644
--- a/moviepy/video/io/VideoFileClip.py
+++ b/moviepy/video/io/VideoFileClip.py
@@ -107,3 +107,8 @@ class VideoFileClip(VideoClip):
del self.reader
except AttributeError:
pass
+
+ try:
+ del self.audio
+ except AttributeError:
+ pass