[Python-projects] Pylint 0.14.0 bug: It does not handle PYLINT_HOME being set.

Pierre Rouleau prouleau001 at sympatico.ca
Sun May 4 15:06:02 CEST 2008


Bonjour,

I have just noticed a little problem with Pylint 0.14 undser Windows, 
when the PYLINTHOME environment variable is defined.

When PYLINTHOME is defined, pylint dies:

D:\dvp\tools\python\ppl>set PYLINTHOME=d:\prouleau

D:\dvp\tools\python\ppl>pylint
Traceback (most recent call last):
  File "c:\Python25\Scripts\pylint.bat", line 11, in <module>
    from pylint import lint
  File "c:\python25\lib\site-packages\pylint\lint.py", line 59, in <module>
    from pylint import config
  File "c:\python25\lib\site-packages\pylint\config.py", line 99, in 
<module>
    PYLINTRC = find_pylintrc()
  File "c:\python25\lib\site-packages\pylint\config.py", line 88, in 
find_pylintrc
    if USER_HOME == '~' or USER_HOME == '/root':
NameError: global name 'USER_HOME' is not defined

The problem is inside config.py and its management of USER_HOME. 
Anyways, here's the patch I applied to get it working.

--- old/config.py       2007-02-22 04:30:06.000000000 -0500
+++ config.py   2008-05-04 08:47:54.998326300 -0400
@@ -27,6 +27,12 @@

 if os.environ.has_key('PYLINTHOME'):
     PYLINT_HOME = os.environ['PYLINTHOME']
+    if PYLINT_HOME.endswith('.pylint.d'):
+        USER_HOME = PYLINTHOME[:-10]    # remove /.pylint.d from the 
name of USER_HOME
+    else:
+        USER_HOME = PYLINT_HOME
+        PYLINT_HOME = join(USER_HOME, '.pylint.d')
+
 else:
     USER_HOME = expanduser('~')
     if USER_HOME == '~':

Hope this helps!

--

Pierre Rouleau


More information about the Python-Projects mailing list