如何解决如何让pylint使用init-hook正确导入我的文件
我遵循these instructions,了解如何使用pylint使用init-hook
正确导入文件。
但是,当我运行终端命令pylint server.py --rcfile=../.pylintrc
时,我得到TypeError: expected str,bytes or os.PathLike object,not NoneType
。 (我认为这是因为init-hook
中找到rcfile的部分以某种方式失败了,但我不确定。)
这是我的.pylintrc
文件,直到相关部分为止(其余只是默认模板):
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=
# Specify a score threshold to be exceeded before program exits with error.
fail-under=10.0
# Add files or directories to the blacklist. They should be base names,not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names,not paths.
ignore-patterns=
# Python code to execute,usually for sys.path manipulation such as
# pygtk.require().
# THIS GIVES THE ERROR
init-hook="from pylint.config import find_pylintrc; import os,sys; sys.path.append(os.path.dirname(find_pylintrc()))"
# THIS GIVES THE SAME ERROR
# init-hook="import os,sys,pylint; sys.path.append(os.path.join(os.path.dirname(pylint.config.PYLINTRC),'platform'))"
如何使此初始化挂钩代码正常工作?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。