Skip to content

Commit

Permalink
Added support for pathlib in save utility (#3663)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Apr 29, 2019
1 parent 9bf1270 commit fa55bb6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions holoviews/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from collections import defaultdict

try:
from pathlib import Path
except:
Path = None

import param
from pyviz_comms import extension as _pyviz_extension

Expand Down Expand Up @@ -738,6 +743,8 @@ def save(obj, filename, fmt='auto', backend=None, **kwargs):
renderer_obj = renderer(backend)
if kwargs:
renderer_obj = renderer_obj.instance(**kwargs)
if Path is not None and isinstance(filename, Path):
filename = str(filename.absolute())
if isinstance(filename, basestring):
supported = [mfmt for tformats in renderer_obj.mode_formats.values()
for mformats in tformats.values() for mfmt in mformats]
Expand Down

0 comments on commit fa55bb6

Please sign in to comment.