python-editor icon indicating copy to clipboard operation
python-editor copied to clipboard

Return None when edited file does not exist

Open davidparsson opened this issue 8 years ago • 0 comments

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

davidparsson avatar Oct 16 '17 08:10 davidparsson