From 54a717dc9152bb5c1b1241e1efa67719567bab60 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Sat, 29 Aug 2020 13:14:20 +0200 Subject: [PATCH] Do not fail hard if preplots do not exist. They might not have been done yet, and it will be obvious to the user if they're not there. --- bin/import_preplots.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/import_preplots.py b/bin/import_preplots.py index f6e0356..273e50b 100755 --- a/bin/import_preplots.py +++ b/bin/import_preplots.py @@ -8,6 +8,7 @@ or modified preplots and (re-)import them into the database. """ from glob import glob +import sys import configuration import preplots from datastore import Datastore @@ -28,7 +29,12 @@ if __name__ == '__main__': print(f"Preplot: {file['path']}") if not db.file_in_db(file["path"]): print("Importing") - preplot = preplots.from_file(file) + try: + preplot = preplots.from_file(file) + except FileNotFoundError: + print(f"File does not exist: {file['path']}", file=sys.stderr) + continue + if type(preplot) is list: print("Saving to DB") db.save_preplots(preplot, file["path"], file["class"], survey["epsg"])