From 9a7f9cb87beb310b1cc2202184bb4af2de4888df Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 5 May 2020 12:16:29 +0200 Subject: [PATCH] build/generic_programmer: catch 404 not found when downloading config/proxy. --- litex/build/generic_programmer.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/litex/build/generic_programmer.py b/litex/build/generic_programmer.py index 2927d829..cb0597d1 100644 --- a/litex/build/generic_programmer.py +++ b/litex/build/generic_programmer.py @@ -47,9 +47,10 @@ class GenericProgrammer: fullname = tools.cygpath(os.path.join(self.prog_local, self.flash_proxy_basename)) try: r = requests.get(d + self.flash_proxy_basename) - with open(fullname, "wb") as f: - f.write(r.content) - return fullname + if r.status_code != 404: + with open(fullname, "wb") as f: + f.write(r.content) + return fullname except: pass raise OSError("Failed to find flash proxy bitstream") @@ -70,9 +71,10 @@ class GenericProgrammer: fullname = tools.cygpath(os.path.join(self.prog_local, self.config)) try: r = requests.get(d + self.config) - with open(fullname, "wb") as f: - f.write(r.content) - return fullname + if r.status_code != 404: + with open(fullname, "wb") as f: + f.write(r.content) + return fullname except: pass raise OSError("Failed to find config file") -- 2.30.2