Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

click.edit() expects editor to be executable with no args #119

Closed
kabniel opened this issue Jun 4, 2014 · 6 comments
Closed

click.edit() expects editor to be executable with no args #119

kabniel opened this issue Jun 4, 2014 · 6 comments

Comments

@kabniel
Copy link

kabniel commented Jun 4, 2014

$ EDITOR='nano -L'
$ export EDITOR
>>> import click
>>> click.edit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "click/termui.py", line 409, in edit
    return editor.edit(text)
  File "click/_termui_impl.py", line 371, in edit
    self.edit_file(name)
  File "click/_termui_impl.py", line 348, in edit_file
    raise ClickException('%s: Editing failed: %s' % (editor, e))
click.exceptions.ClickException: nano -L: Editing failed: [Errno 2] No such file or directory
@mitsuhiko
Copy link
Contributor

To the best of my knowledge EDITOR does not support arguments. If you can point me to a piece of documentation that claims otherwise please reopen this issue.

@untitaker
Copy link
Contributor

afaik kabniel is not able to reopen the issue once you close it, @mitsuhiko

@untitaker
Copy link
Contributor

I believe i have seen the presence of arguments in the EDITOR variable several times when reading through the documentation of Linux distribution. I believe this is similar to the situation with shebangs. However, is there a reason why it should not be allowed? I am aware that the splitting of such a value goes beyond str.split(), but it still shouldn't be too hard.

@mitsuhiko
Copy link
Contributor

Because the behavior is different. If EDITOR accepts arguments then the editor name needs quoting if it's installed into a folder with whitespace which is very common on windows (C:\Program files).

@mitsuhiko
Copy link
Contributor

I changed that now as this is apparently what git and hg do.

@dufferzafar
Copy link

Has this been fixed? I'm facing a similar issue when I try to use VS Code as my editor:

>>> click.edit(editor='code-insiders -w')

/bin/sh: code-insiders -w: command not found

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/click/termui.py", line 587, in edit
    return editor.edit(text)
  File "/usr/lib/python3.8/site-packages/click/_termui_impl.py", line 497, in edit
    self.edit_file(name)
  File "/usr/lib/python3.8/site-packages/click/_termui_impl.py", line 472, in edit_file
    raise ClickException("{}: Editing failed!".format(editor))
click.exceptions.ClickException: code-insiders -w: Editing failed!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants