From 69e82ca60c84f6aadd580c8efa206ffb1de40776 Mon Sep 17 00:00:00 2001 From: Christian Tacke <58549698+ChristianTackeGSI@users.noreply.github.com> Date: Thu, 1 Sep 2022 19:20:31 +0200 Subject: [PATCH] build(metaUpdater): Handle Non-Existant Files If .zenodo.json (or codemeta.json) isn't there, only throw a warning, and continue. --- meta_update.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta_update.py b/meta_update.py index 05d90c51..1dce54d4 100755 --- a/meta_update.py +++ b/meta_update.py @@ -11,6 +11,9 @@ from collections import OrderedDict class Manipulator(object): + def __str__(self): + return self.__class__.__name__ + def load(self, filename): with open(filename, 'rb') as fp: self.data = json.load(fp, object_pairs_hook=OrderedDict) @@ -150,7 +153,11 @@ def main(): args = parser.parse_args() for manipulator in (CodeMetaManipulator(), ZenodoManipulator()): - manipulator.load() + try: + manipulator.load() + except FileNotFoundError as e: + print('*** Skipping {}: {}'.format(manipulator, e)) + continue if args.newversion is not None: manipulator.version(args.newversion) manipulator.update_authors()