[Python-projects] Pylint, virtualenv & init-hook
Tom Crawley
tcrawley at beacon-cs.com
Wed Feb 18 17:54:18 CET 2009
Hi,
I have tried to use pylint with virtualenv in a virtualenvwrapper.
pylint does not pickup the virtualenv entries in sys.path. It alway uses the system sys.path and does
not seem to recognise eggs or egg links as path entries.
I wrote a small init-hook which appends the eggs etc to the sys.path and used it to invoke pylint.
pylint --init-hook='import sys;print sys.path;import virtualenvpath;virtualenvpath.build_path();print sys.path' dbhelper.py
running the command with this hook confirms that the eggs in the virtualenv environment site-packages directory are added
I have attached the egg containing virtualenvpath module.
Pylint does not seem to find the package in the virtualenv locations even though they are on sys.path.
I also tried added the egg-path to sys.path directly and pylint did not find it.
How do I configure an init-hook in the .pylintrc file ?
I tried:
import virtualenvpath as vep;vep.build_path()
This resulted in the Exception:
(BeaconCS.CAFS)[tcrawley at tom64 cafs]$ pylint cahelper.py
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 5, in <module>
pkg_resources.run_script('pylint==0.15.2', 'pylint')
File "build/bdist.linux-i686/egg/pkg_resources.py", line 448, in run_script
File "build/bdist.linux-i686/egg/pkg_resources.py", line 1166, in run_script
File "/usr/local/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/EGG-INFO/scripts/pylint", line 4, in <module>
lint.Run(sys.argv[1:])
File "/usr/local/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/lint.py", line 827, in __init__
linter.load_config_file()
File "/usr/local/lib/python2.5/site-packages/logilab_common-0.37.1-py2.5.egg/logilab/common/configuration.py", line 527, in load_config_file
provider.set_option(option, value, opt_dict=optdict)
File "/usr/local/lib/python2.5/site-packages/pylint-0.15.2-py2.5.egg/pylint/lint.py", line 329, in set_option
BaseRawChecker.set_option(self, opt_name, value, action, opt_dict)
File "/usr/local/lib/python2.5/site-packages/logilab_common-0.37.1-py2.5.egg/logilab/common/configuration.py", line 700, in set_option
raise UnsupportedAction(action)
logilab.common.configuration.UnsupportedAction: callback
Thanks
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VirtualEnvPath-1.0-py2.5.egg
Type: application/x-zip
Size: 2932 bytes
Desc: not available
URL: <http://lists.logilab.org/pipermail/python-projects/attachments/20090218/9f372604/attachment.bin>
More information about the Python-Projects
mailing list