This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
Import error given pylint even package is there and code is working fine #1544
Labels
bug
Something isn't working
FAQ
Issues
Neovim Version
neovim 9
Dev Version?
Operating System
window - wsl -
Minimal Config
Steps to Reproduce
import random
import os
import sys
import pandas as pd
import pysdafas
print("hi amit ")
def amit():
age = random.choice([1, 3, 5])
print(f"amit is {age} year old")
def amitamit(name):
print(name)
print(name)
print(name)
# print(ok)
def amit_a(arg):
a = arg
print(a)
print("amit")
def amit_b():
return random.randint(1, 2)
dsfas
Ok = True
print("ok")
def full_name(first, last_name):
return f"your full name is {first}, {last_name}"
full_name("amit", "tiwari")
data = dict(name="amit", age=45)
df = pd.DataFrame(data, index=["name", "age"])
p = os.getenv("PWD") + f".venv/lib/python{sys.version[:4]}/site-packages"
sys.path.append(os.path.abspath(p))
sys w.path.append(p)
print(p)
print(df)~
for i in p:
sys.path = sys.path + p
print(sys.path)
Reproducibility Check
minimal_init.lua
template and that my issue is reproducible by runningnvim --clean -u minimal_init.lua
and following the steps above.Expected Behavior
import error not to shown as python package pandas is there
but error code is in out put of json file code = "E0401",
Actual Behavior
import error is coming even python package pandas is there by pylint but code file is working without error
but error code is in out put of json file code = "E0401",
Debug Log
[TRACE Sat 29 Apr 2023 12:59:30 PM IST] .../.local/share/nvim/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method initialized
[TRACE Sat 29 Apr 2023 12:59:30 PM IST] .../.local/share/nvim/lazy/null-ls.nvim/lua/null-ls/rpc.lua:127: received LSP notification for method textDocument/didOpen
[TRACE Sat 29 Apr 2023 12:59:30 PM IST] .../share/nvim/lazy/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Sat 29 Apr 2023 12:59:30 PM IST] ...y/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:320: spawning command "pylint" at /home/amit with args { "--from-stdin", "/home/amit/test.py", "-f", "json" }
[TRACE Sat 29 Apr 2023 12:59:31 PM IST] ...y/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:204: error output: nil
[TRACE Sat 29 Apr 2023 12:59:31 PM IST] ...y/null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:205: output: [
{
"type": "error",
"module": "test",
"obj": "",
"line": 4,
"column": 0,
"endLine": 4,
"endColumn": 19,
"path": "test.py",
"symbol": "import-error",
"message": "Unable to import 'pandas'",
"message-id": "E0401"
},
{
"type": "error",
"module": "test",
"obj": "",
"line": 5,
"column": 0,
"endLine": 5,
"endColumn": 15,
"path": "test.py",
"symbol": "import-error",
"message": "Unable to import 'pysdafas'",
"message-id": "E0401"
},
{
"type": "warning",
"module": "test",
"obj": "",
"line": 25,
"column": 0,
"endLine": 25,
"endColumn": 5,
"path": "test.py",
"symbol": "pointless-statement",
"message": "Statement seems to have no effect",
"message-id": "W0104"
},
{
"type": "error",
"module": "test",
"obj": "",
"line": 25,
"column": 0,
"endLine": 25,
"endColumn": 5,
"path": "test.py",
"symbol": "undefined-variable",
"message": "Undefined variable 'dsfas'",
"message-id": "E0602"
},
{
"type": "refactor",
"module": "test",
"obj": "",
"line": 33,
"column": 7,
"endLine": 33,
"endColumn": 32,
"path": "test.py",
"symbol": "use-dict-literal",
"message": "Consider using '{"name": 'amit', "age": 45}' instead of a call to 'dict'.",
"message-id": "R1735"
},
{
"type": "warning",
"module": "test",
"obj": "",
"line": 5,
"column": 0,
"endLine": 5,
"endColumn": 15,
"path": "test.py",
"symbol": "unused-import",
"message": "Unused import pysdafas",
"message-id": "W0611"
}
]
[TRACE Sat 29 Apr 2023 12:59:31 PM IST] ...share/nvim/lazy/null-ls.nvim/lua/null-ls/diagnostics.lua:181: received diagnostics from source 5
[TRACE Sat 29 Apr 2023 12:59:31 PM IST] ...share/nvim/lazy/null-ls.nvim/lua/null-ls/diagnostics.lua:182: { {
code = "E0401",
col = 0,
end_col = 19,
end_lnum = 3,
end_row = 4,
lnum = 3,
message = "Unable to import 'pandas'",
message_id = "E0401",
row = 4,
severity = 1,
source = "pylint",
symbol = "import-error"
}, {
code = "E0401",
col = 0,
end_col = 15,
end_lnum = 4,
end_row = 5,
lnum = 4,
message = "Unable to import 'pysdafas'",
message_id = "E0401",
row = 5,
severity = 1,
source = "pylint",
symbol = "import-error"
}, {
code = "W0104",
col = 0,
end_col = 5,
end_lnum = 24,
end_row = 25,
lnum = 24,
message = "Statement seems to have no effect",
message_id = "W0104",
row = 25,
severity = 2,
source = "pylint",
symbol = "pointless-statement"
}, {
code = "E0602",
col = 0,
end_col = 5,
end_lnum = 24,
end_row = 25,
lnum = 24,
message = "Undefined variable 'dsfas'",
message_id = "E0602",
row = 25,
severity = 1,
source = "pylint",
symbol = "undefined-variable"
}, {
code = "R1735",
col = 7,
end_col = 32,
end_lnum = 32,
end_row = 33,
lnum = 32,
message = "Consider using '{"name": 'amit', "age": 45}' instead of a call to 'dict'.",
message_id = "R1735",
row = 33,
severity = 3,
source = "pylint",
symbol = "use-dict-literal"
}, {
code = "W0611",
col = 0,
end_col = 15,
end_lnum = 4,
end_row = 5,
lnum = 4,
message = "Unused import pysdafas",
message_id = "W0611",
row = 5,
severity = 2,
source = "pylint",
symbol = "unused-import"
} }
Help
Yes
Implementation Help
No response
Requirements
The text was updated successfully, but these errors were encountered: