diff --git a/branca/element.py b/branca/element.py index 36a661c..0924af4 100644 --- a/branca/element.py +++ b/branca/element.py @@ -14,6 +14,7 @@ from urllib.request import urlopen from binascii import hexlify from os import urandom +from pathlib import Path from jinja2 import Environment, PackageLoader, Template @@ -159,7 +160,7 @@ def save(self, outfile, close_file=True, **kwargs): close_file : bool, default True Whether the file has to be closed after write. """ - if isinstance(outfile, str) or isinstance(outfile, bytes): + if isinstance(outfile, (str, bytes, Path)): fid = open(outfile, 'wb') else: fid = outfile