Skip to content

Having an $EDITOR with arguments raises an exception #11

@davidparsson

Description

@davidparsson

editor.edit('file') fails when the defined $EDITOR contains spaces:

$ touch /tmp/file
$ export EDITOR='vim -v'
$ python -c 'import editor; editor.edit("/tmp/file")' 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "editor.py", line 103, in edit
    proc = subprocess.Popen(args, close_fds=True, stdout=stdout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

After removing the space, it works:

$ export EDITOR='vim'
$ python -c 'import editor; editor.edit("/tmp/file")'

Originally (and improperly) reported here as an Alembic issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions