Skip to content

Commit 60ae570

Browse files
Add read_rds workaround for rdata on Python 3.8.
1 parent 239a181 commit 60ae570

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pins/drivers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ def load_data(
125125
try:
126126
import rdata
127127

128+
# Can be removed once support for Python 3.8 is dropped.
129+
# The issue is that the last `rdata` available on Python 3.8 was v0.9,
130+
# which doesn'thave the same `rdata.read_rds()` function.
131+
# See https://github.com/rstudio/pins-python/pull/265
132+
if not hasattr(rdata, "read_rds"):
133+
parsed = rdata.parser.parse_file(f)
134+
rdata.conversion.convert(parsed)
135+
128136
return rdata.read_rds(f)
129137
except ModuleNotFoundError:
130138
raise ModuleNotFoundError(

0 commit comments

Comments
 (0)