On Fri, Feb 13, 2009 at 3:24 AM, Richard Jennings <rpjenni...@gmail.com>wrote:
> Hi,
>
> I am not expert in matplotlib, I use it to generate plots for a management
> performance tool.
>
> I have just upgraded this application from 0.98.3 to 0.98.5 and the
> upgrade broke the application in 3 places:
>
>
>
> 1). In units.py, Registry.get_converter(): this method has been made
> recursive in 0.98.5. The problem is that if x is a string then you get a
> recursion error.
>
> The cause is the 'iterable() function called in the line "if converter is
> None and interable(x):" The interable() function is in cbook.py and it
> actually tests to see if the object 'x' has a __len__() method. Call
> iterable() on a string and it returns true.
>
> Do " for thisx in x:" and you will always get the first character in the
> string, which is.... a string!
>
> My solution was to change iterable():
>
> Def iterable(obj):
>
> """
>
> Return true if **obj** is iterable
>
> """
>
> try: obj.__iter__()
>
> except AtributeError: return False
>
> return True
>
>
>
> this seems to have solved the problem.
>
This has been fixed on the SVN trunk. FYI, the problem with your fix above
is that, in general, we want strings to be considered iterable -- just not
in this case. It should also be noted that the purpose of the fix was to
eliminate the confusing infinite recursion. The fact that plotting strings
of numbers works is a coincidence of how matplotlib is coded up and really
should not be considered a supported feature.
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from: Norman Oklahoma United States.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users