Celil Rufat <celil.ru...@gmail.com> writes:

> However, when I try one of the Qt4 examles:
[...]
>   File
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py",
> line 303, in get_fontconfig_fonts
>     status, output = commands.getstatusoutput("fc-list file")
>   File
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py",
> line 56, in getstatusoutput
>     text = pipe.read()
> IOError: [Errno 4] Interrupted system call

I believe the attached patch (already committed to the trunk) should fix
this on Python 2.6, but I don't have a Qt installation to try it out
with. Can you try this on your system?

-- 
Jouni K. Seppänen
http://www.iki.fi/jks

Index: lib/matplotlib/font_manager.py
===================================================================
--- lib/matplotlib/font_manager.py	(revision 7951)
+++ lib/matplotlib/font_manager.py	(working copy)
@@ -42,7 +42,7 @@
             see license/LICENSE_TTFQUERY.
 """
 
-import os, sys, glob
+import os, sys, glob, subprocess
 try:
     set
 except NameError:
@@ -292,16 +292,12 @@
     grab all of the fonts the user wants to be made available to
     applications, without needing knowing where all of them reside.
     """
-    try:
-        import commands
-    except ImportError:
-        return {}
-
     fontext = get_fontext_synonyms(fontext)
 
     fontfiles = {}
-    status, output = commands.getstatusoutput("fc-list file")
-    if status == 0:
+    pipe = subprocess.Popen(['fc-list', '', 'file'], stdout=subprocess.PIPE)
+    output = pipe.communicate()[0]
+    if pipe.returncode == 0:
         for line in output.split('\n'):
             fname = line.split(':')[0]
             if (os.path.splitext(fname)[1][1:] in fontext and
@@ -1244,11 +1240,11 @@
     import re
 
     def fc_match(pattern, fontext):
-        import commands
         fontexts = get_fontext_synonyms(fontext)
         ext = "." + fontext
-        status, output = commands.getstatusoutput('fc-match -sv "%s"' % pattern)
-        if status == 0:
+        pipe = subprocess.Popen(['fc-match', '-sv', pattern], stdout=subprocess.PIPE)
+        output = pipe.communicate()[0]
+        if pipe.returncode == 0:
             for match in _fc_match_regex.finditer(output):
                 file = match.group(1)
                 if os.path.splitext(file)[1][1:] in fontexts:
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to