Pylint抛出configparser.MissingSectionHeaderError:

问题描述

我可以使用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笔记本中执行了上述代码,并且工作正常

我的pylint是最新版本

解决方法

尝试

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

工作