Skip to content

Commit

Permalink
update9to10: make unpickling recurrence rules more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
agateau committed Aug 16, 2024
1 parent 0b058f6 commit 011f413
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yokadi/update/update9to10.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ def createByweekdayValue(rule):


def createJsonStringFromRule(pickledRule):
rule = pickle.loads(pickledRule)
try:
rule = pickle.loads(pickledRule)
except UnicodeDecodeError:
# Some rules fails to unpickle if we don't set encoding to latin1
rule = pickle.loads(pickledRule, encoding="latin1")
dct = {}
dct["freq"] = rule._freq
dct["bymonth"] = tuplify(rule._bymonth)
Expand Down

0 comments on commit 011f413

Please sign in to comment.