I followed these instructions on how to get pylint to import my files correctly using an init-hook
.
However, when I run the terminal command pylint server.py --rcfile=../.pylintrc
I get TypeError: expected str, bytes or os.PathLike object, not NoneType
. (I assume this is because the part of the init-hook
that finds the rcfile is somehow failing, but I'm not sure.)
Here's my .pylintrc
file up to the relevant parts (the rest is just the default template):
[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'))"
How can I get this init-hook code working correctly?