Skip to content

Return None when edited file does not exist #16

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidparsson
Copy link

@davidparsson davidparsson commented Oct 16, 2017

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 davidparsson force-pushed the fix/no-exception-when-file-missing branch from e330071 to ffdfc92 Compare October 16, 2017 08:06
If a user edits a new, non-existent file and decides to not save it,
edit() will return None instead of raising an exception.
@davidparsson davidparsson force-pushed the fix/no-exception-when-file-missing branch from ffdfc92 to 31c3675 Compare October 16, 2017 08:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant