Python Pylint-configparser.MissingSectionHeaderError:

Python Pylint-configparser.MissingSectionHeaderError:,python,pylint,Python,Pylint,我正在使用pylint测试python文件 代码如下 """ Testing the file inside the content""" import json file = r'test.txt' with open(file,'r') as fr: fd = fr.read() print (fd) 下面是要测试的命令 pylint code.py 错误如下 raise MissingSectionHeade

我正在使用pylint测试python文件

代码如下

""" Testing the file inside the content"""
import json

file = r'test.txt'
with open(file,'r') as fr:
    fd = fr.read()
    print (fd)
下面是要测试的命令

pylint code.py
错误如下

raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'C:\\Users\\ayshewew\\.pylintrc', line: 2
'import json\n'
我已经在jupyter笔记本中执行了上述代码,工作正常

My pylint是最新版本

python-m pylint code.py
获得了输出


工作

在Windows 10 python 2.7.17和pylint 1.9.5上运行您的代码时,我得到了一些其他信息:模块代码C:7,0:print关键字后不必要的参数(多余的参数)W:4,0:重新定义内置的“文件”(重新定义的内置)C:4,0:常量名称“文件”不符合大写命名样式(无效名称)C:6,4:常量名称“fd”不符合大写命名样式(无效名称)W:2,0:未使用的导入json(未使用的导入)尝试更新所有模块更新pylint和configparser,并再次尝试显示
C:\\Users\\ayshewew\\\.pylintrc
文件的内容。正如错误消息中明确指出的,第二行似乎包含
import json
,在这种文件中发现这一点似乎非常令人惊讶。