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

bug: isort command fails with unknown error #406

Open
1 task done
szevzol opened this issue May 16, 2024 · 1 comment
Open
1 task done

bug: isort command fails with unknown error #406

szevzol opened this issue May 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@szevzol
Copy link

szevzol commented May 16, 2024

Neovim version (nvim -v)

v0.9.5

Operating system/version

Windows Version 10.0.19045 Build 19045

Add the debug logs

  • I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.

Log file

09:15:38[DEBUG] Running formatters on C:\Users\****\projects\isort\isort.py: { "isort" }
09:15:38[INFO] Run isort on C:\Users\****\projects\isort\isort.py
09:15:38[DEBUG] Run command: { "isort", "--stdout", "--line-ending", "\r\n", "--filename", "C:\\Users\\****\\projects\\isort\\isort.py", "-" }
09:15:38[ERROR] Formatter 'isort' error in jobstart: Vim:E903: Process failed to start: unknown error: "C:\Users\****\projects\isort\isort.PY

Describe the bug

When saving the buffer I see the following error:

Error detected while processing BufWritePre Autocommands for "*":

Imports are not change in python file.

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

  1. nvim -u repro.lua isort.py
  2. save file with :w

Expected Behavior

Import statements should be fixed without error

Minimal example file

isort.py:

import os
import sys

Minimal init.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "stevearc/conform.nvim",
    config = function()
      require("conform").setup({
        log_level = vim.log.levels.DEBUG,
        -- add your config here
        formatters_by_ft = {
            python = { "isort" }
        },
          format_on_save = {
            lsp_fallback = true,
            async = false,
            timeout_ms = 5000,
          },
      })
    end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Additional context

No response

@szevzol szevzol added the bug Something isn't working label May 16, 2024
@gennaro-tedesco
Copy link

gennaro-tedesco commented May 18, 2024

I am seeing a similar error on a macOS 12.7.4 Monterey, the stacktrace being a little more indicative, and namely:

Formatter 'isort' error in jobstart: Vim:E903: Process failed to start: no such file or directory: "/usr/local/bin/isort"

although the executable is indeed present in the specified location

$ which isort
/usr/local/bin/isort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants