We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a8a772 commit 277864aCopy full SHA for 277864a
pins/drivers.py
@@ -1,6 +1,8 @@
1
from pathlib import Path
2
from typing import Sequence
3
4
+import fsspec.implementations.local
5
+
6
from .config import PINS_ENV_INSECURE_READ, get_allow_pickle_read
7
from .errors import PinsInsecureReadError
8
from .meta import Meta
@@ -126,7 +128,12 @@ def load_data(
126
128
127
129
# Equivalent to `rdata.read_rds(f)` but compatible with Python 3.8.
130
# See https://github.com/rstudio/pins-python/pull/265
- 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)
137
return rdata.conversion.convert(parsed)
138
except ModuleNotFoundError:
139
raise ModuleNotFoundError(
0 commit comments