@@ -194,9 +194,9 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, actions=set({}) ) :
194194 raise Exception ("invalid json for shortcut dictionary" , ve )
195195 # Put everything in to resolve the expansions. We call this function recursively just in case there are shortcuts in shortcuts
196196 final_inpt = resolve_expansions ( inpt , shortcutdata )
197- # Remove the tempory files that we created
198- os . remove ( name + ".json" )
199- else : final_inpt = inpt
197+ else : final_inpt = inpt
198+ # Remove the tempory files that we created
199+ if os . path . exists ( name + '.json' ) : os . remove ( name + ".json" )
200200
201201 # Check for value dictionary to use to create labels
202202 if os .path .exists ( 'values_' + name + '.json' ) and not any (broken ) :
@@ -205,9 +205,9 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, actions=set({}) ) :
205205 valuedict = json .load (f )
206206 except json .JSONDecodeError as ve :
207207 raise Exception ("invalid json for value dictionary" , ve )
208- # Remove the tempory files that we created
209- os .remove ( 'values_' + name + ".json" )
210208 else : valuedict = {}
209+ # Remove the tempory files that we created
210+ if os .path .exists ( 'values_' + name + '.json' ) : os .remove ( 'values_' + name + ".json" )
211211
212212 # Create the lexer that will generate the pretty plumed input
213213 lexerfile = os .path .join (os .path .dirname (__file__ ),"PlumedLexer.py" )
0 commit comments