Bug 896182

Summary: IndexError: list index out of range
Product: [Fedora] Fedora Reporter: Steve Dickson <steved>
Component: python-matplotlibAssignee: Jef Spaleta <jspaleta>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: gwync, jonathan.underwood, jspaleta, paulo.cesar.pereira.de.andrade, thibault.north, tomspur, yury
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-28 14:57:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch that fixes the problem none

Description Steve Dickson 2013-01-16 19:35:01 UTC
Created attachment 679770 [details]
Patch that fixes the problem

Description of problem:
Doing the following imports caused the following IndexError:

import os, posix, stat, sys

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm

 File "/usr/lib64/python2.7/site-packages/matplotlib/font_manager.py", line 994, in __init__
    self.defaultFont['afm'] = self.afmfiles[0]
IndexError: list index out of range

Version-Release number of selected component (if applicable):
python-matplotlib-1.2.0-7

How reproducible:
100%

Steps to Reproduce:
1. do the above imports. 

  
Actual results:
IndexError: list index out of range


Expected results:
No errors

Additional info:
The commit that seem to cause the problem:

commit eb9a122389b7ec7e33d9816fa669d7cb1f04521a
Author: pcpa <paulo.cesar.pereira.de.andrade>
Date:   Wed Jan 16 13:59:10 2013 -0200

    Use fontconfig by default (#885307)

The patch that fixes the problem (which is attached)

diff -up matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig matplotlib-1.2.0/lib/matplotlib/font_manager.py
--- matplotlib-1.2.0/lib/matplotlib/font_manager.py.orig	2013-01-16 14:25:29.500964424 -0500
+++ matplotlib-1.2.0/lib/matplotlib/font_manager.py	2013-01-16 14:25:36.114964740 -0500
@@ -991,7 +991,10 @@ class FontManager:
         self.afmfiles = findSystemFonts(paths, fontext='afm') + \
             findSystemFonts(fontext='afm')
         self.afmlist = createFontList(self.afmfiles, fontext='afm')
-        self.defaultFont['afm'] = self.afmfiles[0]
+        try:
+            self.defaultFont['afm'] = self.afmfiles[0]
+        except IndexError:
+            self.defaultFont['afm'] = None
 
         self.ttf_lookup_cache = {}
         self.afm_lookup_cache = {}

Comment 1 Fedora Update System 2013-01-16 21:28:50 UTC
python-matplotlib-1.2.0-8.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-matplotlib-1.2.0-8.fc18

Comment 2 Fedora Update System 2013-01-20 03:14:03 UTC
Package python-matplotlib-1.2.0-8.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-matplotlib-1.2.0-8.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-1066/python-matplotlib-1.2.0-8.fc18
then log in and leave karma (feedback).

Comment 3 Yury V. Zaytsev 2013-01-24 10:15:53 UTC
This update fixes the problem for me, thanks. Sorry, I couldn't figure out how to add bohdi karma yet...

Comment 4 Fedora Update System 2013-01-28 14:57:31 UTC
python-matplotlib-1.2.0-8.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.