[Python-projects] Pylint, virtualenv & init-hook

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Feb 18 21:24:35 CET 2009


Le Wednesday 18 February 2009 17:54:18 Tom Crawley, vous avez écrit :
> Hi,

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.

I think the problem is missing for eggs support in logilab-astng.

> 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:

yep this is a known bug which is fixed in latest logilab-common release (huum, 
may be unreleased yet I don't remember right now).

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science


More information about the Python-Projects mailing list