Make P1 imports not fail if called needlessly.

If their respective configuration keys are not
defined in a survey configuration, the import
routines will print an informational message
and exit successfully.
This commit is contained in:
D. Berge
2020-08-24 19:45:59 +02:00
parent 721dae4084
commit bc784989f6
4 changed files with 24 additions and 4 deletions

View File

@@ -30,7 +30,12 @@ if __name__ == '__main__':
db.set_survey(survey["schema"])
raw_p190 = survey["raw"]["p190"]
try:
raw_p190 = survey["raw"]["p190"]
except KeyError:
print("No raw P1/90 configuration")
exit(0)
pattern = raw_p190["pattern"]
rx = re.compile(pattern["regex"])