简体   繁体   English

VSCode:Linting 不适用于 Python 2.7

[英]VSCode: Linting not working on Python 2.7

System: Win x64 10.0.18363系统:Win x64 10.0.18363

VSCode: 1.43.2 VSCode:1.43.2

Python: 2.7.10 32-bit Python:2.7.10 32 位

My linter just stopped working on VSCode around the time I installed flake8.在我安装 flake8 的时候,我的 linter 刚刚停止在 VSCode 上工作。 I have no clue what is wrong because the linter is running it just does not print any problems.我不知道出了什么问题,因为 linter 正在运行它只是不打印任何问题。 Everytime I run the linter it shows me:每次我运行 linter 时,它都会向我显示:

C:\Python27\python.exe -m pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text "c:\ Correct Path (removed for privacy reasons)"
cwd: c:\ Correct Path (removed for privacy reasons)
(first 2 lines printed again)
##########Linting Output - pylint##########

Nothing ever gets outputted.没有任何东西被输出。 When I switch to Python 3.8 it works perfectly and shows me all the errors as it should.当我切换到 Python 3.8 时,它运行良好,并按应有的方式向我显示所有错误。 It has the exact same output with just different path for Python 3.8.它具有完全相同的输出,只是 Python 3.8 的路径不同。 My settings.json include the following:我的 settings.json 包括以下内容:

"python.pythonPath": "C:\\Python27\\python.exe",
"python.linting.pylintEnabled": true,
"python.linting.pylintUseMinimalCheckers": true,
"python.linting.enabled": true,
"python.linting.mypyEnabled": false,

I tried every settings I could, but there is no difference.我尝试了所有可能的设置,但没有任何区别。 I tried over 5 linters and they all do the same thing.我尝试了超过 5 个短绒,它们都做同样的事情。 I just get no output whatsoever on my console anymore and I don't know why.我只是在我的控制台上没有任何输出,我不知道为什么。 It was working before so I know it is not any path issues.它以前工作过,所以我知道这不是任何路径问题。

The only hint I have, is that if I go to developer tools, there is an error on line 173 of console.ts我唯一的提示是,如果我使用开发人员工具,console.ts 的第 173 行会出现错误

Error Python Extension: 2020-03-29 21:56:02: stderr jediProxy Error (stderr) completion.py:586: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

for the code:对于代码:

(console as any)[entry.severity].apply(console, consoleArgs); 
// underlined red is -> 'apply(console, consoleArgs);'

I tried googling this error, but I was not getting anything that was on my particular problem.我尝试使用谷歌搜索这个错误,但我没有得到任何关于我的特定问题的信息。 Any help would be great.任何帮助都会很棒。

EDIT编辑

I found a temporary solution after a few hours.几个小时后我找到了一个临时解决方案。 It is to simply turn off Jedi.这是简单地关闭绝地。 You have to go to settings and find Python: Jedi Enabled and turn it off.您必须转到设置并找到 Python: Jedi Enabled 并将其关闭。 I say it is temporary as I would prefer to have Jedi on so I will not answer my question just yet.我说这是暂时的,因为我更希望有绝地武士,所以我暂时不会回答我的问题。 This seems like a new bug so I hope this helps others.这似乎是一个新错误,所以我希望这对其他人有所帮助。

应该是绝地版本问题,我通过指定版本来解决。

pip install jedi==0.15.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM