Skip to content

Commit

Permalink
Bug fix to do a quiet crash if a file is missing
Browse files Browse the repository at this point in the history
Gareth Aneurin Tribello authored and Gareth Aneurin Tribello committed Oct 27, 2024
1 parent 131c668 commit 627a986
Showing 3 changed files with 17 additions and 8 deletions.
16 changes: 9 additions & 7 deletions PlumedToHTML/PlumedToHTML.py
Original file line number Diff line number Diff line change
@@ -192,14 +192,16 @@ def get_html( inpt, name, outloc, tested, broken, plumedexe, usejson=None, maxch
for word in line.split() :
if "MOLFILE=" in word :
molfile = word.replace("MOLFILE=","")
iff = open( molfile, 'r' )
content = iff.read()
iff.close()
inputfiles.append(molfile)
inputfilelines.append("1-5")
inputfilelines.append( str(len(content.splitlines())-4) + "-" + str(len(content.splitlines())) )
if os.path.isfile(molfile) :
iff = open( molfile, 'r' )
content = iff.read()
iff.close()
inputfiles.append(molfile)
inputfilelines.append("1-5")
inputfilelines.append( str(len(content.splitlines())-4) + "-" + str(len(content.splitlines())) )
elif "INPUTFILES=" in word :
for n in word.replace("INPUTFILES=","").split(",") : inputfiles.append( n )
for n in word.replace("INPUTFILES=","").split(",") :
if os.path.isfile(n) : inputfiles.append( n )
elif "INPUTFILELINES=" in word :
inputfilelines = word.replace("INPUTFILELINES=","").split(",")

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

setuptools.setup(
name='PlumedToHTML',
version='0.89',
version='0.90',
author="Gareth Tribello",
author_email="[email protected]",
description="A package for creating pretified HTML for PLUMED files",
7 changes: 7 additions & 0 deletions tdata/tests.json
Original file line number Diff line number Diff line change
@@ -143,6 +143,13 @@
"actions": ["MOLINFO"],
"tooltips": ["MOLINFO", "STRUCTURE", "tdata/helix.pdb"],
"badges": ["pass"]
},
{
"input": "#SETTINGS MOLFILE=tdata/notthere.pdb \nMOLINFO STRUCTURE=tdata/helix.pdb",
"index": 22,
"actions": ["MOLINFO"],
"tooltips": ["MOLINFO", "STRUCTURE"],
"badges": ["pass"]
}
]
}

0 comments on commit 627a986

Please sign in to comment.