From 59a6f79c034d279fbc557a195852cf6720f6270d Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Tue, 7 Aug 2018 11:18:26 -0500 Subject: [PATCH] for #110: what about this? --- uproot/rootio.py | 2 ++ uproot/tree.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/uproot/rootio.py b/uproot/rootio.py index 0bbe0089..11b126c5 100644 --- a/uproot/rootio.py +++ b/uproot/rootio.py @@ -54,6 +54,8 @@ ################################################################ high-level interface def open(path, localsource=MemmapSource.defaults, xrootdsource=XRootDSource.defaults, httpsource=HTTPSource.defaults, **options): + if hasattr(path, "__fspath__"): + path = path.__fspath__() if path.__class__.__module__ == "pathlib": import pathlib if isinstance(path, pathlib.Path): diff --git a/uproot/tree.py b/uproot/tree.py index d172d290..0fb74822 100644 --- a/uproot/tree.py +++ b/uproot/tree.py @@ -99,6 +99,8 @@ def _delayedraise(excinfo): raise err.with_traceback(trc) def _filename_explode(x): + if hasattr(x, "__fspath__"): + x = x.__fspath__() if x.__class__.__module__ == "pathlib": import pathlib if isinstance(x, pathlib.Path):