Discussion:
[Matplotlib-users] Error when importing pyplot from matplotlib: »invalid literal for float(): 19#«
knight91
2015-08-07 20:50:44 UTC
Permalink
Python claims to be unable to import pyplot. Apart from that, it has been
running absolutely fine.

I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.

What should I try next?

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
from matplotlib import pyplot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50, in
<module>
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in <module>
_rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 563, in
createFontList
font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#



--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Thomas Caswell
2015-08-07 20:53:34 UTC
Permalink
You have an afm font file with a badly formed header. I thought this was
fixed on the master branch though....
Post by knight91
Python claims to be unable to import pyplot. Apart from that, it has been
running absolutely fine.
I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.
What should I try next?
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
from matplotlib import pyplot
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50, in
<module>
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in <module>
_rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 563, in
createFontList
font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#
--
http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
knight91
2015-08-08 09:51:38 UTC
Permalink
Okay, is there a way to get an afm font file with a nicely formed header? How
could I try to solve this problem?
Post by Thomas Caswell
You have an afm font file with a badly formed header. I thought this was
fixed on the master branch though....
On Fri, Aug 7, 2015 at 4:51 PM knight91 &lt;
Post by knight91
Python claims to be unable to import pyplot. Apart from that, it has been
running absolutely fine.
I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.
What should I try next?
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
from matplotlib import pyplot
File "
<stdin>
", line 1, in
<module>
Post by knight91
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
Post by knight91
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
Post by knight91
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
Post by knight91
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 50, in
<module>
Post by knight91
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
Post by knight91
import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in
<module>
Post by knight91
_rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 563, in
createFontList
font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Benjamin Root
2015-08-10 13:19:41 UTC
Permalink
I don't know for certain, but perhaps the font-forge program has a repair
utility? http://fontforge.github.io/en-US/
Post by knight91
Okay, is there a way to get an afm font file with a nicely formed header? How
could I try to solve this problem?
Post by Thomas Caswell
You have an afm font file with a badly formed header. I thought this was
fixed on the master branch though....
On Fri, Aug 7, 2015 at 4:51 PM knight91 &lt;
Post by knight91
Python claims to be unable to import pyplot. Apart from that, it has
been
Post by Thomas Caswell
Post by knight91
running absolutely fine.
I tried different versions of matplotlib, the one provided in my package
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.
What should I try next?
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
from matplotlib import pyplot
File "
<stdin>
", line 1, in
<module>
Post by knight91
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
Post by knight91
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
Post by knight91
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
Post by knight91
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line
50,
Post by Thomas Caswell
Post by knight91
in
<module>
Post by knight91
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
Post by knight91
import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in
<module>
Post by knight91
_rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
563,
Post by Thomas Caswell
Post by knight91
in
createFontList
font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#
--
http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Thomas Caswell
2015-08-10 13:56:51 UTC
Permalink
Also try deleting your font cache.

Have you tried with the master branch?

Tom
Post by Benjamin Root
I don't know for certain, but perhaps the font-forge program has a repair
utility? http://fontforge.github.io/en-US/
Post by knight91
Okay, is there a way to get an afm font file with a nicely formed header? How
could I try to solve this problem?
Post by Thomas Caswell
You have an afm font file with a badly formed header. I thought this
was
Post by Thomas Caswell
fixed on the master branch though....
On Fri, Aug 7, 2015 at 4:51 PM knight91 &lt;
Post by knight91
Python claims to be unable to import pyplot. Apart from that, it has
been
Post by Thomas Caswell
Post by knight91
running absolutely fine.
I tried different versions of matplotlib, the one provided in my
package
Post by Thomas Caswell
Post by knight91
manager (apt-get) and two (stable & last stable) releases compiled from
source. I reinstalled all packages containting "python" on my system (Ubuntu
14.04 LTS). This error still occurs and prevents me from using pyplot.
What should I try next?
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
from matplotlib import pyplot
File "
<stdin>
", line 1, in
<module>
Post by knight91
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 24, in
<module>
Post by knight91
import matplotlib.colorbar
File "/usr/lib/pymodules/python2.7/matplotlib/colorbar.py", line 29, in
<module>
Post by knight91
import matplotlib.collections as collections
File "/usr/lib/pymodules/python2.7/matplotlib/collections.py", line 23, in
<module>
Post by knight91
import matplotlib.backend_bases as backend_bases
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line
50,
Post by Thomas Caswell
Post by knight91
in
<module>
Post by knight91
import matplotlib.textpath as textpath
File "/usr/lib/pymodules/python2.7/matplotlib/textpath.py", line 11, in
<module>
Post by knight91
import matplotlib.font_manager as font_manager
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1356,
in
<module>
Post by knight91
_rebuild()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1341,
in _rebuild
fontManager = FontManager()
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1008,
in __init__
self.afmlist = createFontList(self.afmfiles, fontext='afm')
File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line
563,
Post by Thomas Caswell
Post by knight91
in
createFontList
font = afm.AFM(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 342, in __init__
parse_afm(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 330, in
parse_afm
dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh)
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 203, in
_parse_char_metrics
bbox = _to_list_of_floats(vals[3][2:])
File "/usr/lib/pymodules/python2.7/matplotlib/afm.py", line 69, in
_to_list_of_floats
return [_to_float(val) for val in s.split()]
ValueError: invalid literal for float(): 19#
--
http://matplotlib.1069221.n5.nabble.com/Error-when-importing-pyplot-from-matplotlib-invalid-literal-for-float-19-tp46000p46002.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...