Comment 6 for bug 1038429

Revision history for this message
Ken (kkinder) wrote :

The problem is this.

At the beginning of /usr/share/software-center/softwarecenter/config.py, it imports either configparser or ConfigParser based on what will import, apparently based on the incorrect belief that "configparser" is for Python3 while "ConfigParser" is Python2.7:

try:
    from configparser import SafeConfigParser
    SafeConfigParser # pyflakes
except ImportError:
    from ConfigParser import SafeConfigParser

So the background is that Python2.x has "ConfigParser" and Python3 has "configparser". Yes, that's kind of weird. In Python3, they decided to standardize on lower-case package names, so ConfigParser became configparser.

The problem is, Software Center's developers didn't realize that the classes also changed somewhat. Example:

Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import configparser, ConfigParser
>>> issubclass(configparser.SafeConfigParser, object)
True
>>> issubclass(ConfigParser.SafeConfigParser, object)
False

Software Center is crashing because ConfigParser and configparser are not identical and apparently, it was just assumed that they were. What I'm not sure is why this only affects a handful of people. Perhaps our ppa's have forced an upgrade in Python that Software Center wasn't tested against. At any rate, here's a patch.