Skip to content

Commit

Permalink
additional checks for gmx output when importing (#186)
Browse files Browse the repository at this point in the history
* additional checks for the gmx output to enable parsing of `gmx help` even
   when other error messages due to MPI appear
* see PR #186 for example case
  • Loading branch information
PolyachenkoYA authored Aug 4, 2020
1 parent de73d84 commit d43d87e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions gromacs/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,14 @@ def load_v5_tools():
'commands'])
for line in out.splitlines()[5:-1]:
line = str(line.decode('ascii')) # Python 3: byte string -> str, Python 2: normal string
if line[4] != ' ':
name = line[4:line.index(' ', 4)]
fancy = make_valid_identifier(name)
if suffix and append:
fancy = '{0!s}_{1!s}'.format(fancy, suffix)
tools[fancy] = tool_factory(fancy, name, driver)

if len(line) > 4:
if (line[4] != ' ') and (' ' in line[4:]):
name = line[4:line.index(' ', 4)]
fancy = make_valid_identifier(name)
if suffix and append:
fancy = '{0!s}_{1!s}'.format(fancy, suffix)
tools[fancy] = tool_factory(fancy, name, driver)
except (subprocess.CalledProcessError, OSError):
pass

Expand Down

0 comments on commit d43d87e

Please sign in to comment.