Skip to content

Commit

Permalink
fix: Fix Jinja2 error for Jinja2 < 2.11
Browse files Browse the repository at this point in the history
Versions of Jinja2 before 2.11 (or 2.11.1)
crash when a Path-like object is given
to the `FileSystemLoader` constructor.

We fix this simply by casting the Path object
to a string.

See issues #67 and #72.
  • Loading branch information
pawamoy committed Apr 3, 2020
1 parent b585a8f commit 387f970
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mkdocstrings/handlers/__init__.py
Expand Up @@ -123,7 +123,7 @@ def __init__(self, directory: str, theme: str) -> None:
else:
raise ThemeNotSupported(theme)

self.env = Environment(autoescape=True, loader=FileSystemLoader(theme_dir))
self.env = Environment(autoescape=True, loader=FileSystemLoader(str(theme_dir)))
self.env.filters["highlight"] = do_highlight
self.env.filters["any"] = do_any

Expand Down

0 comments on commit 387f970

Please sign in to comment.