IOError: [Errno 4] Interrupted system call (Qt4 backend)

When using the Qt4 backend, I’m getting an IOError similar to the one detailed in:

http://old.nabble.com/matplotlib-with-Qt4-backend-td26311369.html

But it’s definitely a separate issue (see Traceback below). This issue also seems specific to Qt (I couldn’t reproduce it on ‘macosx’, ‘tkagg’, or ‘agg’ backends).

I found a number of other people who ran into similar problems with Qt. Their solutions tend to be: catch the error and just try running the process again.

I’m on Qt 4.7.3, OS X 10.6.8, Matplotlib trunk. Any help would be much appreciated.

-Tony

Script reproducing issue

···

========================

import matplotlib

matplotlib.use(‘qt4agg’)

import matplotlib.pyplot as plt

for n in xrange(300):

plt.plot([0, 1])

plt.savefig(‘test.jpg’)

Since it’s a signaling issue, it gets triggered randomly, so the attached

script may or not reproduce the issue.

Traceback

=========

traceback (most recent call last):

File “qterror.py”, line 8, in

plt.savefig(‘test.jpg’)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/pyplot.py”, line 428, in savefig

return fig.savefig(*args, **kwargs)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/figure.py”, line 1162, in savefig

self.canvas.print_figure(*args, **kwargs)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_qt4agg.py”, line

153, in print_figure

FigureCanvasAgg.print_figure(self, *args, **kwargs)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backend_bases.py”, line 1979, in

print_figure

**kwargs)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backend_bases.py”, line 1799, in

print_jpg

buf, size = agg.print_to_buffer()

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_agg.py”, line 45

7, in print_to_buffer

FigureCanvasAgg.draw(self)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_agg.py”, line 40

0, in draw

self.renderer = self.get_renderer()

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_agg.py”, line 41

1, in get_renderer

self.renderer = RendererAgg(w, h, self.figure.dpi)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_agg.py”, line 51

, in init

RendererBase.init(self)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/backend_bases.py”, line 114, in _

init_

self._text2path = textpath.TextToPath()

File “/Users/Tony/python/devel/mpl/lib/matplotlib/textpath.py”, line 37, in _init

_

self._adobe_standard_encoding = self._get_adobe_standard_encoding()

File “/Users/Tony/python/devel/mpl/lib/matplotlib/textpath.py”, line 41, in _get_ad

obe_standard_encoding

enc_name = dviread.find_tex_file(‘8a.enc’)

File “/Users/Tony/python/devel/mpl/lib/matplotlib/dviread.py”, line 837, in find_te

x_file

result = pipe.communicate()[0].rstrip()

File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subpro

cess.py", line 663, in communicate

stdout = self.stdout.read()

IOError: [Errno 4] Interrupted system call