From 5f5bf79742552194eeb5256026ae60e9cfe94426 Mon Sep 17 00:00:00 2001 From: hlu1 <14827759+hlu1@users.noreply.github.com> Date: Fri, 10 May 2019 22:55:11 -0700 Subject: [PATCH] [Bugfix] Check file exists before removing it (#3178) --- python/tvm/contrib/download.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tvm/contrib/download.py b/python/tvm/contrib/download.py index 46a9a6d..bc6d324 100644 --- a/python/tvm/contrib/download.py +++ b/python/tvm/contrib/download.py @@ -111,7 +111,8 @@ def download(url, path, overwrite=False, size_compare=False, verbose=1, retries= except Exception as err: retries -= 1 if retries == 0: - os.remove(tempfile) + if os.path.exists(tempfile): + os.remove(tempfile) raise err else: print("download failed due to {}, retrying, {} attempt{} left" -- 2.7.4