Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle floats with commas in AFM files #2497

Closed
wants to merge 1 commit into from
Closed

Handle floats with commas in AFM files #2497

wants to merge 1 commit into from

Conversation

sandrotosi
Copy link
Contributor

Hello,
a Debian user reported http://bugs.debian.org/691916 and I'm about to include this diff in the Debian package, to handle float numbers with ',' instead of '.' in AFM files.

@sandrotosi
Copy link
Contributor Author

After a failure test build, I'm closing this PR as it causes more harm than it fixes:

ERROR: Failure: TypeError (expected bytes, bytearray or buffer compatible object)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 1348, in <module>
    fontManager = pickle_load(_fmcache)
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 947, in pickle_load
    with open(filename, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: './fontList.py3k.cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/failure.py", line 38, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/nose/loader.py", line 402, in loadTestsFromName
    module = resolve_name(addr.module)
  File "/usr/lib/python3/dist-packages/nose/util.py", line 311, in resolve_name
    module = __import__('.'.join(parts_copy))
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/tests/test_agg.py", line 12, in <module>
    from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/backends/backend_agg.py", line 27, in <module>
    from matplotlib.backend_bases import RendererBase,\
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/backend_bases.py", line 50, in <module>
    import matplotlib.textpath as textpath
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/textpath.py", line 11, in <module>
    import matplotlib.font_manager as font_manager
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 1356, in <module>
    _rebuild()
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 1341, in _rebuild
    fontManager = FontManager()
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 1008, in __init__
    self.afmlist = createFontList(self.afmfiles, fontext='afm')
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/font_manager.py", line 563, in createFontList
    font = afm.AFM(fh)
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/afm.py", line 342, in __init__
    parse_afm(fh)
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/afm.py", line 329, in parse_afm
    dhead = _parse_header(fh)
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/afm.py", line 162, in _parse_header
    d[key] = headerConverters[key](val)
  File "/home/morph/deb/build-area/matplotlib-1.3.1~rc2/build/lib.linux-x86_64-3.3/matplotlib/afm.py", line 55, in <lambda>
    _to_float = lambda x: float(x.replace(',','.'))
TypeError: expected bytes, bytearray or buffer compatible object

As it seems a file format violation to have an AFM file with floats using commas, I'll leave to the distro font handlers to deal with it.

Sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant