Bug 896182 - IndexError: list index out of range
Summary: IndexError: list index out of range
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-matplotlib
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jef Spaleta
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-01-16 19:35 UTC by Steve Dickson
Modified: 2013-01-28 14:57 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-01-28 14:57:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Patch that fixes the problem (779 bytes, patch)
2013-01-16 19:35 UTC, Steve Dickson
no flags Details | Diff

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.


Note You need to log in before you can comment on or make changes to this bug.