Users have reported a hard crash in an application running on a headless machine. The subset of code that triggers the exception is
gc = GraphicsContext(temp_frame, pix_format="rgb24")
gc.set_font(Font(face_name="Verdana", size=self.size))
The full traceback is
Traceback (most recent call last):
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 412, in _load_from_cache_or_rebuild
fontManager = _pickle_load(cache_file)
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 460, in _pickle_load
fh = open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/centos/.enthought/kiva/fontList.cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[Traceback from private package]
gc.set_font(Font(face_name="Verdana", size=self.size))
File "[edm environment]/lib/python3.6/site-packages/kiva/agg/agg.py", line 1216, in set_font
spec = font.findfont()
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font.py", line 130, in findfont
return default_font_manager().findfont(query)
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 65, in default_font_manager
fontManager = _load_from_cache_or_rebuild(_get_font_cache_path())
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 419, in _load_from_cache_or_rebuild
fontManager = _new_font_manager(cache_file)
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 437, in _new_font_manager
fontManager = FontManager()
File "[edm environment]/lib/python3.6/site-packages/kiva/fonttools/font_manager.py", line 110, in __init__
self.default_font["ttf"] = ttffiles[0]
IndexError: list index out of range
Note that the user also reported seeing the following warning on the machine.
In [2]: from kiva.image import GraphicsContext
...:
/home/msmarte/.edm/envs/kiva-test/lib/python3.6/site-packages/kiva/image.py:19: Warning: Error initializing Agg: No module named '_plat_support'
from .agg import GraphicsContextArray as GraphicsContext
At the moment, the culprit seems to be
|
# Load TrueType fonts and create font database. |
|
ttffiles = scan_system_fonts(paths) + scan_system_fonts() |
|
for fname in ttffiles: |
|
logger.debug("trying fontname %s", fname) |
|
if fname.lower().find("vera.ttf") >= 0: |
|
self.default_font["ttf"] = fname |
|
break |
|
else: |
|
# use anything |
|
self.default_font["ttf"] = ttffiles[0] |
Users have reported a hard crash in an application running on a headless machine. The subset of code that triggers the exception is
The full traceback is
Note that the user also reported seeing the following warning on the machine.
At the moment, the culprit seems to be
enable/kiva/fonttools/font_manager.py
Lines 101 to 110 in 7b9eff4