diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 78d15fe29b88..ba01622bd068 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -257,7 +257,8 @@ def _setup_latex_process(self, *, expect_reply=True): # Open LaTeX process for real work; register it for deletion. On # Windows, we must ensure that the subprocess has quit before being # able to delete the tmpdir in which it runs; in order to do so, we - # must first `kill()` it, and then `communicate()` with it. + # must first `kill()` it, and then `communicate()` with or `wait()` on + # it. try: self.latex = subprocess.Popen( [mpl.rcParams["pgf.texsystem"], "-halt-on-error"], @@ -274,7 +275,10 @@ def _setup_latex_process(self, *, expect_reply=True): def finalize_latex(latex): latex.kill() - latex.communicate() + try: + latex.communicate() + except RuntimeError: + latex.wait() self._finalize_latex = weakref.finalize( self, finalize_latex, self.latex)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: