![]() |
Frequently Asked Questions for PyLint |
Frequently Asked Questions for PyLint
Question:
Is it possible to give file as argument to pylint, instead of module ?
Answer:
pylint expects the name of a package or module as argument. As a convenience, you can give to it a file name if it's possible to guess a module name from the file's path, using the python path. Some examples : "pylint mymodule.py" should always works since the current working directory is automatically added on top of the python path "pylint directory/mymodule.py" will work if "directory" is a python package (i.e. has an __init__.py file) or if "directory" is in the python path. "pylint /whatever/directory/mymodule.py" will work if either:
Question:
I'm using psyobj from psyco and get a lot of spurious "unused variables messages". Is it normal ?
Answer:
Yes. That's actually due to a bug in psyco, making the locals() function for objects inheriting from psyobj returning an empty dictionary. For the moment, the only way to fix this is to use the PYLINT_IMPORT environment variable to not use psyco during pylint checking. Sample code
import os
try:
if os.environ.has_key('PYLINT_IMPORT'):
raise ImportError()
from psyco.classes import psyobj
except ImportError:
class psyobj:
pass
|