ignore when version records file does not exist

This commit is contained in:
lilydjwg 2017-08-30 14:26:25 +08:00
parent e25f0bebce
commit dfbc91f22e
1 changed files with 7 additions and 4 deletions

View File

@ -49,10 +49,13 @@ def safe_overwrite(fname, data, *, method='write', mode='w', encoding=None):
def read_verfile(file): def read_verfile(file):
v = {} v = {}
with open(file) as f: try:
for l in f: with open(file) as f:
name, ver = l.rstrip().split(None, 1) for l in f:
v[name] = ver name, ver = l.rstrip().split(None, 1)
v[name] = ver
except FileNotFoundError:
pass
return v return v
def write_verfile(file, versions): def write_verfile(file, versions):