{"record":{"id":"395e6674a5aa0778","repo":"matplotlib/matplotlib","slug":"failed-to-parse-path-as-postscript-encoding","errorCode":null,"errorMessage":"Failed to parse {path} as Postscript encoding","messagePattern":"Failed to parse (.+?) as Postscript encoding","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/dviread.py","lineNumber":1248,"sourceCode":"\n    The format supported by this function is a tiny subset of PostScript.\n\n    Parameters\n    ----------\n    path : `os.PathLike`\n\n    Returns\n    -------\n    list\n        The nth list item is the PostScript glyph name of the nth glyph.\n    \"\"\"\n    no_comments = re.sub(\"%.*\", \"\", Path(path).read_text(encoding=\"ascii\"))\n    array = re.search(r\"(?s)\\[(.*)\\]\", no_comments).group(1)\n    lines = [line for line in array.split() if line]\n    if all(line.startswith(\"/\") for line in lines):\n        return [line[1:] for line in lines]\n    else:\n        raise ValueError(f\"Failed to parse {path} as Postscript encoding\")\n\n\nclass _LuatexKpsewhich:\n    @cache  # A singleton.\n    def __new__(cls):\n        self = object.__new__(cls)\n        self._proc = self._new_proc()\n        return self\n\n    def _new_proc(self):\n        return subprocess.Popen(\n            [\"luatex\", \"--luaonly\", str(cbook._get_data_path(\"kpsewhich.lua\"))],\n            # mktexpk logs to stderr; suppress that.\n            stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,\n            # Store generated pk fonts in our own cache.\n            env={\"MT_VARTEXFONTS\": str(Path(mpl.get_cachedir(), \"vartexfonts\")),\n                 **os.environ})\n","sourceCodeStart":1230,"sourceCodeEnd":1266,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/dviread.py#L1230-L1266","documentation":"Error \"Failed to parse {path} as Postscript encoding\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/dviread.py:1248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}