Skip to content

Wrong reader in mathext.py #7106

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

Closed
lijunsun opened this issue Sep 13, 2016 · 2 comments
Closed

Wrong reader in mathext.py #7106

lijunsun opened this issue Sep 13, 2016 · 2 comments

Comments

@lijunsun
Copy link

This bug happens when drawing a figure when using AFM fonts (ps.useafm=True) and setting ScalarFormatter(useMathText=True),

The _sanity_check() function in aft.py requires a BufferedReader, while the "_get_font()" function in mathext.py returns TextIOWrapper

if cached_font is None:
fname = os.path.join(self.basepath, basename + ".afm")
with open(fname, 'r') as fd:
print(fd)
cached_font = AFM(fd)
cached_font.fname = fname
self.fonts[basename] = cached_font
self.fonts[cached_font.get_fontname()] = cached_font
return cached_font

The line "with open(fname, 'r') as fd:" should be "with open(fname, 'rb') as fd:"

@tacaswell
Copy link
Member

Can you try with the 2.0.0b4 release?

This should be fixed by #6898

@tacaswell
Copy link
Member

@lijunsun Thank you for taking the time to report this issue and suggest a solution!

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

No branches or pull requests

3 participants