I didn't expect anything to be honest. In fact I just wanted to know if this problem is known or not. Before I posted I crawled through earlier revisions of cbook.py on github. All revisions I found used the ominous os.path.walk().

In the next step I copied an older FontList.cache to the new name and tried reimporting pylab. That gave me an ValueError while unpickling.

I attached both tracebacks, without FontList.py3k.cache present and with it.

So I will try rewriting this part to get a FontList.py3k.cache using Py3k.

Greetz Tobi

------------------------------------
Following the traceback for importing pylab without a FontList.py3k.cache present:


Python 3.2 (unknown, Apr  6 2011, 18:44:52)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 1309, in <module>
    fontManager = pickle_load(_fmcache)
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 922, in pickle_load
    fh = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: '/home/erg/.matplotlib/fontList.py3k.cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
File "/usr/local/lib/python3.2/site-packages/matplotlib/pylab.py", line 221, in <module>
    from matplotlib import mpl  # pulls in most modules
File "/usr/local/lib/python3.2/site-packages/matplotlib/mpl.py", line 2, in <module>
    from matplotlib import axis
File "/usr/local/lib/python3.2/site-packages/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 1317, in <module>
    _rebuild()
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 1304, in _rebuild
    fontManager = FontManager()
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 967, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 317, in findSystemFonts
    files = list_fonts(path, fontexts)
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 167, in list_fonts
    return cbook.listFiles(directory, pattern)
File "/usr/local/lib/python3.2/site-packages/matplotlib/cbook.py", line 1069, in listFiles
    os.path.walk(root, visit, arg)
AttributeError: 'module' object has no attribute 'walk'
>>>
------------------------

Traceback with a copy of an older FontList.cache:

Python 3.2 (unknown, Apr  6 2011, 18:44:52)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 1309, in <module>
    fontManager = pickle_load(_fmcache)
File "/usr/local/lib/python3.2/site-packages/matplotlib/font_manager.py", line 924, in pickle_load
    data = pickle.load(fh)
ValueError: invalid literal for int() with base 10: "9\nNtRp173\n(dp174\ng12\ng13\nsg14\nS'Sarai'\np175\nsg16\nI400\nsg17\ng13\nsg18\ng13\nsg19\nS'/usr/share/fonts/truetype/ttf-devanagari-fonts/Sarai_07.ttf'\np176\nsg21\ng22\nsbag7\n(g8\ng9\nNtRp177\n(dp178\ng12\ng61\nsg14\nS'GFS"

During handling of the above exception, another exception occurred:
-- snip -- the same exception regaring os.path.walk()



On 04/08/2011 09:06 PM, Michael Droettboom wrote:
Can you provide a traceback? I think this usage of os.path.walk may have crept back in from a recent merge from master. It didn't get noticed because it only runs if the user doesn't already have a font cache file.

I don't have a chance to look at this right now, but it you want to submit a patch to convert this os.path.walk usage to os.walk, that would of course be appreciated.

In general, don't expect the Python 3.x branch to be terribly useful for production work right now... There's probably lots of sharp edges like this still lingering beneath the surface.

Cheers,
Mike

On 04/08/2011 03:50 PM, Tobias Hoppe wrote:
Hi all,

grepping matplotlib-py3k from github, configuring, compiling and installing with python3.2 under Ubuntu posed no problems. Firing up python and import matplotlib shows no errors in the first place. Importing pylab brings up errors in cbook.py, namely the call to os.path.walk() in line 1069 which is deprecated since python3.0.

Without a proper replacement for os.path.walk() FontList.cache can't be generated. Is it just my fault at some point or is it still broken and needs fixing? If it needs fixing I will gladly look into it. What get's me wondering is that someone managed to get a simple plot out of mpl on python3.

Please give me a hint, if I need to work on it.

Greetz, Tobi


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev


_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev


_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to