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

Fix AttributeError: 'NoneType' object has no attribute 'stdout' for all versions of Python #1185

Merged
merged 4 commits into from
May 7, 2020
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [v1.0.3](https://github.com/zulko/moviepy/tree/v1.0.3) (2020-05-07)

[Full Changelog](https://github.com/zulko/moviepy/compare/v1.0.2...v1.0.3)

Bonus release to fix critical error when working with audio: `AttributeError: 'NoneType' object has no attribute 'stdout'` [\#1185](https://github.com/Zulko/moviepy/pull/1185)


## [v1.0.2](https://github.com/zulko/moviepy/tree/v1.0.2) (2020-03-26)

[Full Changelog](https://github.com/zulko/moviepy/compare/v1.0.1...v1.0.2)
Expand Down
3 changes: 0 additions & 3 deletions moviepy/audio/io/AudioFileClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,3 @@ def close(self):
if self.reader:
self.reader.close_proc()
self.reader = None

def __del__(self):
self.close()
1 change: 1 addition & 0 deletions moviepy/audio/io/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def close_proc(self):
for std in [ self.proc.stdout,
self.proc.stderr]:
std.close()
self.proc.wait()
self.proc = None

def get_frame(self, tt):
Expand Down
2 changes: 1 addition & 1 deletion moviepy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.2"
__version__ = "1.0.3"
17 changes: 17 additions & 0 deletions tests/test_VideoFileClip.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,22 @@ def test_ffmpeg_resizing():
video.close()


def test_shallow_copy():
"""Call a function which uses @outplace
and verify that making a shallow copy and deleting it
does not corrupt the original clip."""
video_file = 'media/big_buck_bunny_0_30.webm'
video = VideoFileClip(video_file)
video_copy = video.set_start(1)
del video_copy
# The clip object buffers 200000 frames, around 5 seconds ahead.
# When recentering the buffer, if the new buffer is more than 1000000 frames, around 25s
# ahead of the end of the current buffer, the reader will reinitialize and fix self.proc
# Thus to trigger the bug, you have to look for a frame between ~5 and ~30 seconds away.
# These numbers might vary for different reasons and it would be nice to have a test
# which was robust to changes in default buffer size, etc.
video.audio.make_frame(15)


if __name__ == '__main__':
pytest.main()