码迷,mamicode.com
首页 > 编程语言 > 详细

python-matplotlib 中 import pyplot 出现错误的解决.

时间:2016-02-07 02:24:26      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:

出现_getfullpathname : emedded null character 的解决方法:(转自http://stackoverflow.com)

 

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):
    continue
if not os.path.dirname(direc):
    direc = os.path.join(directory, direc)
direc = direc.split(‘\0‘, 1)[0]

python-matplotlib 中 import pyplot 出现错误的解决.

标签:

原文地址:http://www.cnblogs.com/aqdaye/p/5184492.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!