Skip to content

Commit

Permalink
More graceful dssp version check failure if dssp is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
pckroon committed Mar 7, 2024
1 parent 9c45529 commit 53f13e9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vermouth/dssp/dssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,14 @@ def run_dssp(system, executable='dssp', savedir=None, defer_writing=True):
savefile = _savefile_path(system, savedir)
else:
savefile = None
# check version
process = subprocess.run([executable, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
match = re.search('\d+\.\d+\.\d+', process.stdout.decode('UTF8'))
version = match[0] if match else None
try:
# check version
process = subprocess.run([executable, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError as error:
raise DSSPError('Failed to get DSSP version information.') from error

Check warning on line 273 in vermouth/dssp/dssp.py

View check run for this annotation

Codecov / codecov/patch

vermouth/dssp/dssp.py#L272-L273

Added lines #L272 - L273 were not covered by tests
else:
match = re.search('\d+\.\d+\.\d+', process.stdout.decode('UTF8'))
version = match[0] if match else None
if not version:
raise DSSPError('Failed to get DSSP version information.')
if not version in SUPPORTED_DSSP_VERSIONS:
Expand Down

0 comments on commit 53f13e9

Please sign in to comment.