python-editor
python-editor copied to clipboard
Return None when edited file does not exist
If a user edits a new, non-existent file and decides to not save it, edit() will return None instead of raising an exception.
On master, when not saving the file in the editor:
$ python -c 'import editor; print(editor.edit("/tmp/does-not-exist"))'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "editor.py", line 100, in edit
with open(filename, mode='rb') as f:
IOError: [Errno 2] No such file or directory: '/tmp/does-not-exist'
On this branch:
$ python -c 'import editor; print(editor.edit("/tmp/does-not-exist"))'
None