Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialize proc to None #637

Merged
2 commits merged into from
Aug 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion moviepy/video/io/ffmpeg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(self, filename, print_infos=False, bufsize = None,
fps_source='tbr'):

self.filename = filename
self.proc = None
infos = ffmpeg_parse_infos(filename, print_infos, check_duration,
fps_source)
self.fps = infos['video_fps']
Expand Down Expand Up @@ -178,7 +179,7 @@ def get_frame(self, t):
return result

def close(self):
if hasattr(self,'proc'):
if self.proc:
self.proc.terminate()
self.proc.stdout.close()
self.proc.stderr.close()
Expand Down
6 changes: 5 additions & 1 deletion tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()