-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black Vim Error Formatting File: Error invoking python_execute
#1293
Comments
Same here! |
It looks like this function was added in #1273, so the Vim plugin was updated to call this function, while the installed package doesn't (yet) have this function. Looks like this comment holds the current solution:
|
for a temp local solution this works for me:
or to checkout to the version tag: |
I'm using |
Here's a workaround using
|
until psf/black#1293 is resolved
Avoid issue here: psf/black#1293
Just ran into this. This basicaly makes whole Black unusable in Vim. |
The problem is with the installed |
The fix from @bkjohnson has the advantage of pinning the vim version to match the installed release. Thank you for that. |
I had the same issue and could solve it with the proposed fix. However, I observed that it only occurred in the python environments in which pynvim was installed. |
For what it's worth, I also have |
I do not |
Your method is very good, thank you! |
With Plug 'psf/black', { 'tag': '*' } |
@ambv sorry to at you, but do you have an idea when this could be potentially be fixed? Thanks for your great effort and amazing job! |
The solution from #1273 didn't work for me since I had black installed at the system level and that was the one picked up so I had to do something like
which seems to have replaced my systemwide install of black with the tip of git. |
If black version in site-packages isn't master, will fail, so use the coc.nvim format for black See also: psf/black#1293
I added this key mapping au FileType python nnoremap <buffer> <a-f> :silent !black -S %<CR><CR> No more black plugin! |
That can be noticeably slower though, as you incur black's startup time cost each time you format. |
I ran into problems when Vim was upgraded to 8.2.587. My temporary workaround:
Update vim-plugin:
Upgrade black used by the vim-plugin to the latest from master:
This should work when there is a new release of Black on PyPI I reckon. |
@akselsjogren That gets you a bleeding edge version of |
As I wrote, the bleeding edge of master (8654e8d) is what is needed to get the plugin working with later vim versions. |
Oh right, sorry :) I misunderstood the purpose of your comment because that's a somewhat different issue -- the latest release of the plugin being incompatible with latest Vim, and how to get around that. This issue is about the fact that current installation instructions are likely to result in different versions of the But maybe |
@dlukes I'm on macOS 10.15.4, vim 8.2 (installed via home-brew, I put However, when I run vim, I get the following error:
If I:
and run vim, I get a new error:
Do you or @akselsjogren have other suggestions? Thanks in advance for your time. |
@weaming's workaround did not work for me. I made my own workaround in
but I still have to hit |
@erikr Why put the process into background using |
@weaming Running the process in the background gives an illusion of speed, since this approach incurs startup time per @dlukes. If I call the command without |
@erikr Try |
@erikr The solution I suggested makes sure that both the Vim plugin and the Python library are set to the latest released version. Unfortunately, as @akselsjogren has pointed out, Vim 8.2.587 is incompatible with the latest released version of the plugin, so your best bet is to use the |
By the way, I think this issue can now be closed thanks to #1318. For |
@weaming @dlukes Thanks so much for both of your comments. I cleaned up prior installs of
Then changed my Then ran However I still get this error:
Any other steps you'd suggest? |
@erikr You can't currently use the stable branch of black with Vim 8.2.587, so the advice to Please follow the instructions by akselsjogren that I've linked to in my previous reply, they should help you make sure that you have the latest master of both the Vim plugin and the Python library. EDIT: And once #1348 makes it into a stable release, then consider switching to |
Hi @dlukes Thanks for clarifying. I am trying to perform the following instructions from @akselsjogren that you linked to:
However I do not have
#1375 seems similar. What step am I missing here? |
@erikr That's weird, but I can confirm this happens with Homebrew Vim 8.2.654 on macOS (I normally use Neovim). It seems to be a completely unrelated problem though, so please file a different issue for that. Feel free to re-use any information provided in the Details section below :) (I made it collapsible because I'd rather not hijack this thread any more than it already has been, the issue mentioned in OP has been addressed and this issue should be closed.) DetailsWhen the virtualenv is created,
On that last line, it should be If you can't see that error message, wipe the black virtualenv and restart Vim. If it flies by too quickly, you can redisplay it with |
Also rm -rf ~/.vim/black rm -rf ~/.vim/plugged/black psf/black#1293 https://github.com/psf/black/pull/1318/files
Pins Black plugin version to tag 19.10b0 which is equal to the Arch package version. See also <psf/black#1293>. Signed-off-by: Tibor Šimko <[email protected]>
With isort - now isort isn't found even though is exists clearly in PATH (but not in virtualenv). With black, tried workaround at psf/black#1293 (comment), but now skip-string-normalization = true is being ignored by both pyproject.toml and vim g:black_skip_string_normalization. These projects are indispensible. I wish JS had something like isort. Black is a fast and beautiful formatter. I'm counting my blessings! The vim plugins, on the other hand have not been dependable for me. Over the years. I have switched to and fro many many times. And perhaps I'm the one making the environment break some how. I can sympathize: It's extraordinarily hard to have integration tests for vim plugins across neovim, vim, and environments/projects to simulate if something breaks.
Syntastic fights with CoC. Black main is unstable, switch to stable branch for updates. per psf/black#1293
Hi, I upgraded all the vim-plug plugins recently. And it seems Is this happening with recent release too? |
Hi, I have a similar situation. I'm also getting errors about pyproject_toml with |
Guys, please just update your pip version to 20 and python3 to 3.9 then that problem will be solved. At least you can use the latest version of black on your vim. |
This is the only version that will work for me until pip 20 and python 3.9: psf/black#1293 (comment)
psf/black#1293 Should work fine once we ditch elasticsearch-curator and can use a more recent version of black
for lua configs, this worked for me:
|
I think this has been fixed by later releases and #1318 |
until psf/black#1293 is resolved
Describe the bug A clear and concise description of what the bug is.
When saving/formatting a python file via
:Black
in Vim, it produced the following error:To Reproduce Steps to reproduce the behavior:
:Black
and hit Enter to saveExpected behavior
Python code should be formatted without errors
Environment (please complete the following information):
Does this bug also happen on master? To answer this, you have two options:
No I don't think so.
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: