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.
This commit is contained in:
D. Berge
2020-08-29 13:14:20 +02:00
parent a9247c691c
commit 54a717dc91

View File

@@ -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"])