Skip to content

Commit

Permalink
Add read_rds workaround for rdata on Python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjmcdougall committed Jul 25, 2024
1 parent 6963828 commit 1122cdb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pins/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ def load_data(
try:
import rdata

# Can be removed once support for Python 3.8 is dropped.
# The issue is that the last `rdata` available on Python 3.8 was v0.9,
# which doesn'thave the same `rdata.read_rds()` function.
# See https://github.com/rstudio/pins-python/pull/265
if not hasattr(rdata, "read_rds"):
parsed = rdata.parser.parse_file(f)
rdata.conversion.convert(parsed)

return rdata.read_rds(f)
except ModuleNotFoundError:
raise ModuleNotFoundError(
Expand Down

0 comments on commit 1122cdb

Please sign in to comment.