2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

pyon/store_file: do not erase file when encoding fails

This commit is contained in:
Sebastien Bourdeauducq 2014-12-31 17:20:12 +08:00
parent cda394e0ce
commit 0aa450ad5d

View File

@ -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):