forked from M-Labs/artiq
pyon/store_file: do not erase file when encoding fails
This commit is contained in:
parent
cda394e0ce
commit
0aa450ad5d
|
@ -156,8 +156,9 @@ def store_file(filename, x):
|
|||
"""Encodes a Python object and writes it to the specified file.
|
||||
|
||||
"""
|
||||
contents = encode(x, True)
|
||||
with open(filename, "w") as f:
|
||||
f.write(encode(x, True))
|
||||
f.write(contents)
|
||||
|
||||
|
||||
def load_file(filename):
|
||||
|
|
Loading…
Reference in New Issue