Skip to content

Commit

Permalink
recipy#155, recipy#98: Moved error handling from find_editor and anno…
Browse files Browse the repository at this point in the history
…tate get_editor. Removed blank lines in README.md
  • Loading branch information
trbedwards committed Sep 19, 2016
1 parent d82dfba commit 97cb88a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -233,6 +233,4 @@ This table lists the modules recipy has patches for, and the input and output fu
</tbody>
</table>



However, the code example above shows how easy it is to write a class to wrap a new module - so please feel free to submit a Pull Request to make recipy work with your favourite scientific modules!
4 changes: 1 addition & 3 deletions recipyCmd/recipycmd.py
Expand Up @@ -141,10 +141,8 @@ def main():


def annotate(args):
# check whether editor is set
# get the text editor
editor = get_editor()
if editor is None:
raise RuntimeError('No custom editor set in ~/.recipy/recipyrc file and could not find default $EDITOR.')

# Grab latest run from the DB
run = get_latest_run()
Expand Down
10 changes: 5 additions & 5 deletions recipyCommon/config.py
Expand Up @@ -53,6 +53,10 @@ def get_editor():
editor = '$EDITOR'
else:
editor = find_editor()
if editor is None or editor is '':
raise RuntimeError("Cannot launch text editor. "
"Try setting the editor in the ~/.recipy/recipyrc file")

return editor


Expand All @@ -69,11 +73,7 @@ def find_editor():
elif "win" in platform: # windows
editor = _try_editors(["edit", "notepad", "notepad.exe"])
else:
raise RuntimeError("Cannot launch text editor for operating system %s. "
"Try setting the editor in the ~/.recipy/recipyrc file" % platform)
if editor is None:
raise RuntimeError("Try setting the editor in the ~/.recipy/recipyrc file")

editor = None
return editor


Expand Down

0 comments on commit 97cb88a

Please sign in to comment.