diff --git a/lib/matplotlib/texmanager.py b/lib/matplotlib/texmanager.py index 760a693ffba..c1a2010c957 100644 --- a/lib/matplotlib/texmanager.py +++ b/lib/matplotlib/texmanager.py @@ -53,7 +53,7 @@ import matplotlib as mpl from matplotlib import rcParams from matplotlib._png import read_png -from matplotlib.cbook import mkdirs +from matplotlib.cbook import mkdirs, Locked from matplotlib.compat.subprocess import Popen, PIPE, STDOUT import matplotlib.dviread as dviread import re @@ -403,7 +403,8 @@ def make_dvi(self, tex, fontsize): 'latex -interaction=nonstopmode %s > "%s"' % (os.path.split(texfile)[-1], outfile)) mpl.verbose.report(command, 'debug') - exit_status = os.system(command) + with Locked(self.texcache): + exit_status = os.system(command) try: with open(outfile) as fh: report = fh.read()