From cda62a2eff3d69ddd241f52ec0748404f66d0b5a Mon Sep 17 00:00:00 2001 From: Pedro Mendes Date: Thu, 16 May 2024 22:21:07 -0400 Subject: [PATCH] exits with 255 when files not found --- sbmodelr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbmodelr b/sbmodelr index 199a272..d593edd 100755 --- a/sbmodelr +++ b/sbmodelr @@ -138,7 +138,7 @@ def read_network(network_file): netf = f.read() except FileNotFoundError: print(f'ERROR: file {network_file} not found') - exit() + exit(-1) # create list for links ll = [] # check if this is a digraph @@ -146,7 +146,7 @@ def read_network(network_file): ll.append((0,0)) # check for the odd case of /* and */ appearing inside separate quotes and refuse to parse if( re.search(r'"[\s\S]*?\/\*[\s\S]*\*\/[\s\S]*?"', netf) ): - print(fr'{network_file} contains identifiers with \* and *\, and cannot be parsed') + print(fr' Warning: {network_file} contains identifiers with \* and *\, and cannot be parsed') return [] # remove comments netf = re.sub(r'\s*//.*', '', netf) # // comments @@ -417,7 +417,7 @@ if( args.network ): seedmodel = load_model(seedmodelfile, remove_user_defined_functions=True) if( seedmodel is None): print(f'ERROR: {seedmodelfile} failed to load.\n') - exit() + exit(-1) # print some information about the model if( not args.quiet ):