Hi,

Replying to my own question: although it can be made to work on Windows by 
keeping the bundled Python's DLLs folder and importing the libs and 
site-packages of the desired external Python, it is not a good idea to run 
Pylint this way because the caching of imports means that file changes are not 
recognised. 


Until Pylint stops doing real imports, the best way to run it from a Python 
program is subprocess.

Cheers,
Mike




________________________________
From: Michael Rans <[email protected]>
To: [email protected]
Sent: Sat, 29 January, 2011 8:21:31
Subject: [Python-projects] Running Pylint from one Python install using 
different Python version


Hi,

I have written a  Pylint plugin for Editra. Pylint runs much faster if I invoke 
it  directly rather than via subprocess although it requires some hackery  
described 
here:http://stackoverflow.com/questions/2028268/invoking-pylint-programmatically/4803466#4803466

Editra is installed  by p2exe or py2app, hence it has internally a bundled 
Python (2.6 at  the moment). I can add to the path from the local Python 
install 
(which  may be Python 2.7 or Python 2.5 for example) using sys.path.append the  
things required to run pylint and the script pylint is to check eg. 
sys.path.append(“C:\Python25\Lib\site-packages\pylint-0.21.2-py2.5.egg”). 



1.     What will happen if pylint-0.21.2-py2.5.egg or pylint-0.21.2-py2.7.egg 
runs through the Editra bundled Python (2.6)? Will there be compatibility 
issues?
2.    To make it a valid check so that modules found in the Editra Python don’t 
affect the pylinting, I guess I could do: 

origsyspath = sys.path
sys.path = [“C:\Python27\Lib”, 
“C:\Python27\Lib\site-packages\pylint-0.21.2-py2.7.egg” ...]
pylint.lint ...
sys.path = origsyspath    Will the Python 2.6 bundled with Editra fall over 
with 
things from C:\Python27\Lib when pylint is run with the altered sys.path? 


You may be wondering why I don’t just invoke through subprocess. I have tried 
that, but there is some  issue with path when launching pylint in a subprocess 
using py2app on  Mac but not with py2exe on Windows. Also direct calling is 
much 
faster.

Any help with my questions 1 and 2 above would be appreciated.

Cheers,
Mike


      
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to