[Matplotlib-users] Error on import matplotlib.pyplot (on Anaconda3 for Windows 10 Home 64-bit PC)

Benjamin Root ben.v.root at gmail.com
Tue Dec 1 15:35:08 EST 2015

To defend against linkrot, here is that user's answer:

This is a bug in python, not matplotlib.

The issue is that winreg.EnumValue is not cutting string values at their
length properly for some reason, and strings will include null characters
which os.path.abspath is not able to process.

The registry entry where this happens is at SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Fonts. Despite this not being matplotlib's fault we can
still temporarily patch it so that it ends the string at '\0'. In
font_manager.py, patch line 310 in the win32InstalledFonts() function to:

key, direc, any = winreg.EnumValue( local, j)if not is_string_like(direc):
    continueif not os.path.dirname(direc):
    direc = os.path.join(directory, direc)
direc = direc.split('\0', 1)[0]

On Tue, Dec 1, 2015 at 3:29 PM, anshul6 via Matplotlib-users <
matplotlib-users at python.org> wrote:

> In case anyone else is facing this issue, "simonzack" wrote a  simple patch
> <http://stackoverflow.com/a/34007642/5622032>   on StackOverflow that
> fixed
> the problem for me!
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Error-on-import-matplotlib-pyplot-on-Anaconda3-for-Windows-10-Home-64-bit-PC-tp46477p46504.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20151201/9123aa3c/attachment-0001.html>

More information about the Matplotlib-users mailing list