Description
Bug report
Bug summary
While trying some LD_PRELOAD tricks, test_save_animation_smoketest failed for me with
lib/matplotlib/tests/test_animation.py:173: in test_save_animation_smoketest
dpi=dpi, codec=codec)
lib/matplotlib/animation.py:1261: in save
writer.grab_frame(**savefig_kwargs)
/usr/lib/python3.6/contextlib.py:88: in __exit__
next(self.gen)
lib/matplotlib/animation.py:237: in saving
self.finish()
raise RuntimeError(msg)
E RuntimeError: Error creating movie, return code: 127 Try setting mpl.verbose.set_level("helpful")
Well that's tricky to do within the tests which set classic mode, so let's instead patch
try:
stdout = [s.decode() for s in self._proc._stdout_buff]
stderr = [s.decode() for s in self._proc._stderr_buff]
verbose.report("MovieWriter.finish: stdout: %s" % stdout,
level='helpful')
verbose.report("MovieWriter.finish: stderr: %s" % stderr,
level='helpful')
except Exception as e:
pass
to raise the error instead (pass -> raise).
I now get
lib/matplotlib/tests/test_animation.py:173: in test_save_animation_smoketest
dpi=dpi, codec=codec)
lib/matplotlib/animation.py:1262: in save
writer.grab_frame(**savefig_kwargs)
/usr/lib/python3.6/contextlib.py:88: in __exit__
next(self.gen)
lib/matplotlib/animation.py:237: in saving
self.finish()
lib/matplotlib/animation.py:577: in finish
"\n" + str(self._proc._stderr_buff))
E AttributeError: 'Popen' object has no attribute '_stdout_buff'
Code for reproduction
Apply the suggested patch and run pytest (suggested with --instafail (pytest-instafail) so that the traceback appears early, as test_animation is one of the first ones to be run).
Actual outcome
An exception is thrown while trying to generate an error message. (The actual error was due to the fact that I tried to LD_PRELOAD the fixed version of libfreetype into matplotlib, but that also affected the subprocess -- so that error is not really relevant.)
Expected outcome
The actual error message gets displayed.
Matplotlib version
- Operating System: Arch Linux
- Matplotlib Version: master
- Python Version: 3.6
- Jupyter Version (if applicable): NA
- Other Libraries:
The use of a private subprocess API seem to have come in through #5628. We should definitely just use a public API here. The private API still exists on Windows, but has been removed on Unices in python/cpython@3a4586a (I think), i.e. all supported Python versions.
Probably never caught because no one actually uses verbose mode... (perhaps tests should use verbose mode by default, actually -- especially as pytest will buffer away the output unless a failure actually occurs).