On Tue, Mar 13, 2012 at 10:43 PM, Stephane Gagnon
<ste...@gm...> wrote:
> while trying out animation.ArtistAnimation, my script would not
> terminate. The .mp4 file was generated and later found out that the
> script would block at proc.wait() within _make_movie. ffmpeg
> generates quite a bit of text and it seems that if stdout/stderr are
> not closed, wait() does not return (this is on Windows). I have made
> some modifications to animation.py to get it to work, but can't tell
> how this will behave on other platforms.
>
>
> Proposed change in matplotlib/animation.py:
>
> def _make_movie(self, fname, fps, codec, frame_prefix, cmd_gen=None):
> # Uses subprocess to call the program for assembling frames into a
> # movie file. *cmd_gen* is a callable that generates the sequence
> # of command line arguments from a few configuration options.
> from subprocess import Popen, PIPE
> if cmd_gen is None:
> cmd_gen = self.ffmpeg_cmd
> command = cmd_gen(fname, fps, codec, frame_prefix)
> verbose.report('Animation._make_movie running command: %s'%'
> '.join(command))
> proc = Popen(command, shell=False,
> stdout=PIPE, stderr=PIPE)
> + proc.stdout.close()
> + proc.stderr.close()
> proc.wait()
Thanks for the report. The code to write movie files has been
refactored substantially to improve a wide variety of problems. One
changes has been to use communicate() instead of wait(), both to get
stdout and stderr text, but also to fix a similar problem on linux.
Can you try replacing the close() and wait() calls with just a single
call to communicate() and see if that also fixes your problem?
Thanks,
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
|