magmax / python-inquirer

A collection of common interactive command line user interfaces, based on Inquirer.js (https://github.com/SBoudrias/Inquirer.js/)
MIT License
992 stars 98 forks source link

inquirer.Editor crashes when $EDITOR has arguments #153

Open 23Skidoo opened 2 years ago

23Skidoo commented 2 years ago

I have $EDITOR set to emacsclient -t -a zile, which makes inquirer.Editor crash when trying to open the editor:

>>> import inquirer
>>> inquirer.prompt([inquirer.Editor("question")])
[?] : Press <enter> to launch your editor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mikhail/.local/lib/python3.8/site-packages/inquirer/prompt.py", line 14, in prompt
    answers[question.name] = render.render(question, answers)
  File "/home/mikhail/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 44, in render
    return self._event_loop(render)
  File "/home/mikhail/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 57, in _event_loop
    self._process_input(render)
  File "/home/mikhail/.local/lib/python3.8/site-packages/inquirer/render/console/__init__.py", line 110, in _process_input
    render.process_input(ev.value)
  File "/home/mikhail/.local/lib/python3.8/site-packages/inquirer/render/console/_editor.py", line 34, in process_input
    data = editor.edit(contents=self.question.default or '')
  File "/home/mikhail/.local/lib/python3.8/site-packages/editor.py", line 101, in edit
    proc = subprocess.Popen(args, close_fds=True, stdout=stdout)
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'emacsclient -t -a zile'

Starting python with EDITOR=zile python3 fixes this.

23Skidoo commented 2 years ago

Appears to be a (known) issue with the python-editor package: https://github.com/fmoo/python-editor/issues/11.

Cube707 commented 2 years ago

jup, this is an upstream issue we have no control over