File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11from pathlib import Path
22from typing import Sequence
33
4+ import fsspec .implementations .local
5+
46from .config import PINS_ENV_INSECURE_READ , get_allow_pickle_read
57from .errors import PinsInsecureReadError
68from .meta import Meta
@@ -126,7 +128,12 @@ def load_data(
126128
127129 # Equivalent to `rdata.read_rds(f)` but compatible with Python 3.8.
128130 # See https://github.com/rstudio/pins-python/pull/265
129- parsed = rdata .parser .parse_file (f )
131+ if isinstance (f , fsspec .implementations .local .LocalFileOpener ):
132+ # rdata requires f to be a BinaryIO object.
133+ io_f = f .f
134+ else :
135+ io_f = f
136+ parsed = rdata .parser .parse_file (io_f )
130137 return rdata .conversion .convert (parsed )
131138 except ModuleNotFoundError :
132139 raise ModuleNotFoundError (
You can’t perform that action at this time.
0 commit comments