mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] Pickle need binary mode
This commit is contained in:
parent
812cd37822
commit
4432e22412
1 changed files with 2 additions and 2 deletions
|
@ -388,7 +388,7 @@ class ActionsMap(object):
|
||||||
if use_cache and os.path.exists(actionsmap_pkl):
|
if use_cache and os.path.exists(actionsmap_pkl):
|
||||||
try:
|
try:
|
||||||
# Attempt to load cache
|
# Attempt to load cache
|
||||||
with open(actionsmap_pkl) as f:
|
with open(actionsmap_pkl, 'rb') as f:
|
||||||
actionsmaps[n] = pickle.load(f)
|
actionsmaps[n] = pickle.load(f)
|
||||||
# TODO: Switch to python3 and catch proper exception
|
# TODO: Switch to python3 and catch proper exception
|
||||||
except (IOError, EOFError):
|
except (IOError, EOFError):
|
||||||
|
@ -554,7 +554,7 @@ class ActionsMap(object):
|
||||||
|
|
||||||
pkl = '%s-%d-%d.pkl' % (n, am_file_stat.st_size, am_file_stat.st_mtime)
|
pkl = '%s-%d-%d.pkl' % (n, am_file_stat.st_size, am_file_stat.st_mtime)
|
||||||
|
|
||||||
with open_cachefile(pkl, 'w', subdir='actionsmap') as f:
|
with open_cachefile(pkl, 'wb', subdir='actionsmap') as f:
|
||||||
pickle.dump(actionsmaps[n], f)
|
pickle.dump(actionsmaps[n], f)
|
||||||
|
|
||||||
return actionsmaps
|
return actionsmaps
|
||||||
|
|
Loading…
Add table
Reference in a new issue