Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FileNotFoundError while import matplotlib (maybe pyplot) #9485

Closed
@ha-nso-li

Description

@ha-nso-li

Bug report

Traceback

Traceback (most recent call last):
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 1444, in <module>
    fontManager = json_load(_fmcache)
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 973, in json_load
    with open(filename, 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\hanso\\.matplotlib\\fontList.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/hanso/PycharmProjects/reinforcement-learning-kr/2-cartpole/1-dqn/cartpole_dqn.py", line 3, in <module>
    import pylab
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\pylab.py", line 257, in <module>
    from matplotlib import cbook, mlab, pyplot as plt
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\colorbar.py", line 36, in <module>
    import matplotlib.contour as contour
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\contour.py", line 21, in <module>
    import matplotlib.font_manager as font_manager
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 1454, in <module>
    _rebuild()
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 1434, in _rebuild
    fontManager = FontManager()
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 1060, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 323, in findSystemFonts
    for f in win32InstalledFonts(fontdir):
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\site-packages\matplotlib\font_manager.py", line 240, in win32InstalledFonts
    direc = os.path.abspath(direc).lower()
  File "C:\Users\hanso\AppData\Local\Programs\Python\Python35\lib\ntpath.py", line 535, in abspath
    path = _getfullpathname(path)
ValueError: _getfullpathname: embedded null character

And I couldn't find C:\Users\hanso\.matplotlib\fontList.json

Code for reproduction

https://github.com/rlcode/reinforcement-learning-kr/blob/master/2-cartpole/1-dqn/cartpole_dqn.py

Matplotlib version

  • Operating system: Windows 10 64bit 1703
  • Matplotlib version: 2.1.0
  • Matplotlib backend : TkAgg
  • Python version: 3.5.4

I installed matplotlib via pip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions