Package: pylint
Version: 0.25.2-1
Severity: normal
Tags: patch

I am looking into pylint for the first time, playing around with pylint-gui. After dealing with http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667065 , I added the standard '--include-ids' option to a generated rc file (this is the first thing n00bs are told to do):

=======================================================

pylint --include-ids y --generate-rcfile > ~/.pylintrc

=======================================================

However, when you next call pylint-gui and try to load a script...

=======================================================

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
File "/usr/lib/pymodules/python2.7/pylint/gui.py", line 343, in periodic_call
    if self.process_incoming():
File "/usr/lib/pymodules/python2.7/pylint/gui.py", line 331, in process_incoming
    if (self.msg_type_dict.get(msg[0])()):
TypeError: 'NoneType' object is not callable

=======================================================

Its clear pylint-gui hasn't been tested/used much, as its relying on the bare configuration of the 'message type' being passed as a single character string ('C', 'W' etc)... including the IDs naturally appends them to this character, subsequently breaking the GUI when it tries to load the package/script.

Please see the patch for how I've fixed it based off the http://download.logilab.org/pub/pylint/pylint-0.25.2.tar.gz source - I found the problem in the original place, then git grep'd for more instances of the code, which there was one other.


--- System information. ---
Architecture: amd64
Kernel:       Linux 3.2.0-3-amd64

Debian Release: wheezy/sid
  500 testing         security.debian.org
  500 testing         ftp.uk.debian.org
  500 stable          www.getgnash.org
  500 quodlibet-unstable www.student.tugraz.at

--- Package information. ---
Depends                     (Version) | Installed
=====================================-+-============
python                       (>= 2.6) | 2.7.3~rc2-1
python-support            (>= 0.90.0) | 1.0.15
python-logilab-common     (>= 0.53.0) | 0.58.0-1
python-logilab-astng      (>= 0.21.1) | 0.23.1-1


Recommends      (Version) | Installed
=========================-+-===========
python-tk                 | 2.7.3-1


Package's Suggests field is empty.
diff --git a/gui.py b/gui.py
index 2d8e81e..ffe6c16 100644
--- a/gui.py
+++ b/gui.py
@@ -292,7 +292,11 @@ class LintGui:
         #clear the window
         self.lbMessages.delete(0, END)
         for msg in self.msgs:
-            if (self.msg_type_dict.get(msg[0])()):
+
+            # Obtaining message type (pylint's '--include-ids' appends the ID to this letter...)
+            msgType = msg[0][:1] if len(msg[0]) > 1 else msg[0]
+
+            if (self.msg_type_dict.get(msgType)()):
                 msg_str = self.convert_to_string(msg)
                 self.lbMessages.insert(END, msg_str)
                 fg_color = COLORS.get(msg_str[:3], 'black')
@@ -327,8 +331,11 @@ class LintGui:
                 #adding message to list of msgs
                 self.msgs.append(msg)
 
+                # Obtaining message type (pylint's '--include-ids' appends the ID to this letter...)
+                msgType = msg[0][:1] if len(msg[0]) > 1 else msg[0]
+
                 #displaying msg if message type is selected in check box
-                if (self.msg_type_dict.get(msg[0])()):
+                if (self.msg_type_dict.get(msgType)()):
                     msg_str = self.convert_to_string(msg)
                     self.lbMessages.insert(END, msg_str)
                     fg_color = COLORS.get(msg_str[:3], 'black')

Reply via email to