Video editing with Python
initialize proc to None (#637)
Michael Gygliea70a9e15854
diff --git a/moviepy/video/io/ffmpeg_reader.py b/moviepy/video/io/ffmpeg_reader.pyindex 28b100aa..82e5cb1a 100644--- a/moviepy/video/io/ffmpeg_reader.py+++ b/moviepy/video/io/ffmpeg_reader.py@@ -28,6 +28,7 @@ class FFMPEG_VideoReader:fps_source='tbr'):self.filename = filename+ self.proc = Noneinfos = ffmpeg_parse_infos(filename, print_infos, check_duration,fps_source)self.fps = infos['video_fps']@@ -178,7 +179,7 @@ class FFMPEG_VideoReader:return resultdef close(self):- if hasattr(self,'proc'):+ if self.proc:self.proc.terminate()self.proc.stdout.close()self.proc.stderr.close()diff --git a/tests/test_issues.py b/tests/test_issues.pyindex e895f812..7296917c 100644--- a/tests/test_issues.py+++ b/tests/test_issues.py@@ -281,7 +281,11 @@ def test_issue_547():video=concatenate_videoclips([red, green, blue])assert video.duration == 6-+def test_issue_636():+ with VideoFileClip("media/big_buck_bunny_0_30.webm").subclip(0,11) as video:+ with video.subclip(0,1) as subclip:+ pass+if __name__ == '__main__':pytest.main()