visual-studio-code - Default pylintrc completely disables pylint
问题描述
All I want to do is use the generated-members=
line to disable the false "no-members" errors for several packages.
So, in the VS Code terminal, in my project root directory, I run:
pylint --generate-rcfile > .pylintrc
All linting warnings immediately disappear, even before I've change anything in the rc file. The only way I've been able to bring them back is by deleting .pylintrc. What am I doing wrong?
解决方案
我能够诊断问题并找到解决方法。问题是 rcfile 是以错误的编码生成的。运行pylint mymodule
给出以下错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
如此处所述。
我没有找到让 pylint 以正确编码生成配置文件的方法,但作为一种解决方法,我只是在 Notepad++ 中打开了 .pylintrc 文件,在那里将编码更改为 UTF-8,然后保存文件。之后,即使在 VS Code 中进行后续编辑,.pylintrc 文件仍保持正确的编码,从而允许 linting 正常工作。
推荐阅读
- database-connection - 难以连接到在线 postgreSQL 结构化数据库到超集
- excel - Excel ActiveX 组合框将所选日期显示为数字而不是日期
- ios - 焦点集合视图项
- python - 随机整数并接收它们并保存它们
- python - 解决密集点稀疏
- c# - 模型中的 C# 属性为 Labelfor 和 EditorFor
- python - Tensorflow 图像分类损失 NAN
- python - 处理点击流以在 Pandas 中创建功能的最佳方法
- javascript - 无法使用 JDBC (Node.js) 访问 ignite 数据库的元数据?
- javascript - 为什么这个输入值一直给我未定义?