8000 FileNotFoundError for font_manager · Issue #12439 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
FileNotFoundError for font_manager #12439
Closed
@high242

Description

@high242

Bug report

Bug summary

I can find font_manager.py in my folder, but it cannot recognise that
Code for reproduction
import matplotlib

Actual outcome

# If applicable, paste the console output here
#
#
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in <module>()
   1352         try:
-> 1353             fontManager = json_load(_fmcache)
   1354             if (not hasattr(fontManager, '_version') or

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in json_load(filename)
    887     """
--> 888     with open(filename, 'r') as fh:
    889         return json.load(fh, object_hook=_json_decode)

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\victor\\.matplotlib\\fontlist-v300.json'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-1-5c78ffaa5488> in <module>()
----> 1 get_ipython().run_line_magic('matplotlib', 'inline')
      2 import pandas as pd

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
   2129                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2130             with self.builtin_trap:
-> 2131                 result = fn(*args,**kwargs)
   2132             return result
   2133 

<decorator-gen-108> in matplotlib(self, line)

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\IPython\core\magics\pylab.py in matplotlib(self, line)
     97             print("Available matplotlib backends: %s" % backends_list)
     98         else:
---> 99             gui, backend = self.shell.enable_matplotlib(args.gui)
    100             self._show_matplotlib_backend(args.gui, backend)
    101 

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\IPython\core\interactiveshell.py in enable_matplotlib(self, gui)
   3047                 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
   3048 
-> 3049         pt.activate_matplotlib(backend)
   3050         pt.configure_inline_support(self, backend)
   3051 

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\IPython\core\pylabtools.py in activate_matplotlib(backend)
    308     matplotlib.rcParams['backend'] = backend
    309 
--> 310     import matplotlib.pyplot
    311     matplotlib.pyplot.switch_backend(backend)
    312 

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\pyplot.py in <module>()
     30 from cycler import cycler
     31 import matplotlib
---> 32 import matplotlib.colorbar
     33 import matplotlib.image
     34 from matplotlib import rcsetup, style

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\colorbar.py in <module>()
     30 import matplotlib.collections as collections
     31 import matplotlib.colors as colors
---> 32 import matplotlib.contour as contour
     33 import matplotlib.cm as cm
     34 import matplotlib.gridspec as gridspec

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\contour.py in <module>()
     16 import matplotlib.colors as mcolors
     17 import matplotlib.collections as mcoll
---> 18 import matplotlib.font_manager as font_manager
     19 import matplotlib.text as text
     20 import matplotlib.cbook as cbook

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in <module>()
   1361             raise
   1362         except Exception:
-> 1363             _rebuild()
   1364     else:
   1365         _rebuild()

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in _rebuild()
   1342         global fontManager
   1343 
-> 1344         fontManager = FontManager()
   1345 
   1346         if _fmcache:

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in __init__(self, size, weight)
    976         self.defaultFont = {}
    977 
--> 978         ttffiles = findSystemFonts(paths) + findSystemFonts()
    979         self.defaultFont['ttf'] = next(
    980             (fname for fname in ttffiles

c:\users\victor\appdata\local\programs\python\python35\lib\site-packages\matplotlib\font_manager.py in findSystemFonts(fontpaths, fontext)
    262             fontpaths = [win32FontDirectory()]
    263             # now get all installed fonts directly...
--> 264             fontfiles.update(win32InstalledFonts(fontext=fontext))
    265         else:
    266             fontpaths = X11FontDirectories

TypeError: 'NoneType' object is not iterable

Expected outcome

Matplotlib version

  • Operating system: Win10
  • Matplotlib version: 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version: 3.5
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0