Skip to content

Commit

Permalink
Fix AttributeError: 'NoneType' object has no attribute 'stdout' for…
Browse files Browse the repository at this point in the history
… all versions of Python (#1185)
  • Loading branch information
tburrows13 authored May 7, 2020
1 parent d54c195 commit db19920
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
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()

0 comments on commit db19920

Please sign in to comment.