From dfbc91f22e39a592360e4a0026022813a9041891 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Wed, 30 Aug 2017 14:26:25 +0800 Subject: [PATCH] ignore when version records file does not exist --- nvchecker/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nvchecker/core.py b/nvchecker/core.py index 97827c9..abf424f 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -49,10 +49,13 @@ def safe_overwrite(fname, data, *, method='write', mode='w', encoding=None): def read_verfile(file): v = {} - with open(file) as f: - for l in f: - name, ver = l.rstrip().split(None, 1) - v[name] = ver + try: + with open(file) as f: + for l in f: + name, ver = l.rstrip().split(None, 1) + v[name] = ver + except FileNotFoundError: + pass return v def write_verfile(file, versions):