Skip to content

Return None when edited file does not exist - #16

Open
davidparsson wants to merge 1 commit into
fmoo:masterfrom
davidparsson:fix/no-exception-when-file-missing
Open

Return None when edited file does not exist#16
davidparsson wants to merge 1 commit into
fmoo:masterfrom
davidparsson:fix/no-exception-when-file-missing

Conversation

@davidparsson

@davidparssondavidparsson commented Oct 16, 2017

Copy link
Copy Markdown

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
davidparssonforce-pushed the fix/no-exception-when-file-missing branch from e330071 to ffdfc92CompareOctober 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
davidparssonforce-pushed the fix/no-exception-when-file-missing branch from ffdfc92 to 31c3675CompareOctober 16, 2017 08:06
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@davidparsson