From 67a056d8856c883cfea695195e55d9a3f7fdd500 Mon Sep 17 00:00:00 2001 From: jgenero Date: Fri, 10 Mar 2023 22:36:34 +0100 Subject: [PATCH] add try/except in _create_doc() --- app/cmd/db.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/cmd/db.py b/app/cmd/db.py index 96ffc68..c5cc6f5 100644 --- a/app/cmd/db.py +++ b/app/cmd/db.py @@ -99,6 +99,11 @@ def _create_doc(folder: str)-> None: # query on table institution with to get the correspondant institution key inst_query = [t.id_institution for t in Institution.select().where( Institution.full_label == doc_archives)] + try: + inst_query[0] + except IndexError: + print("!! Add", doc_archives, "to /app/data_actes/institution_data.py") + break infos_doc.append({ "inst_doc": inst_query[0], "collection_doc": doc_cote,