kazam icon indicating copy to clipboard operation
kazam copied to clipboard

python 3.6.8, AttributeError: 'KazamConfig' object has no attribute 'default_section'

Open mahhov opened this issue 5 years ago • 2 comments

kazam
/usr/bin/kazam:32: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk
Traceback (most recent call last):
  File "/usr/bin/kazam", line 146, in <module>
    from kazam.app import KazamApp
  File "/usr/lib/python3/dist-packages/kazam/app.py", line 35, in <module>
    from kazam.backend.prefs import *
  File "/usr/lib/python3/dist-packages/kazam/backend/prefs.py", line 478, in <module>
    prefs = Prefs()
  File "/usr/lib/python3/dist-packages/kazam/backend/prefs.py", line 119, in __init__
    self.config = KazamConfig()
  File "/usr/lib/python3/dist-packages/kazam/backend/config.py", line 76, in __init__
    super().__init__(self)
  File "/usr/lib/python3.6/configparser.py", line 614, in __init__
    for key, value in defaults.items():
  File "/usr/lib/python3.6/_collections_abc.py", line 743, in __iter__
    for key in self._mapping:
  File "/usr/lib/python3.6/configparser.py", line 989, in __iter__
    return itertools.chain((self.default_section,), self._sections.keys())
AttributeError: 'KazamConfig' object has no attribute 'default_section'

"/usr/lib/python3.6/configparser.py", line 989 looks like:

    def __iter__(self):
        # XXX does it break when underlying container state changed?
        return itertools.chain((self.default_section,), self._sections.keys())

mahhov avatar Sep 26 '19 15:09 mahhov

Does python not have the equivalent of package-lock.json used npm for JS which avoids having incorrect versions of dependencies break builds?

mahhov avatar Sep 26 '19 15:09 mahhov

Btw, according to configparser documentation, the default value of default_section should be 'DEFAULT'.

default_section, default value: configparser.DEFAULTSECT (that is: "DEFAULT")

It seems for whatever reason this default value is not being set. Adding it to line 29 (top of class KazamConfig definition) in /usr/lib/python3/dist-packages/kazam/backend/config.py fixes the issue.

default_section = "DEFAULT"

I don't really know python, so there may be reasons why this shouldn't be done? or there may be a better solution?

mahhov avatar Sep 26 '19 15:09 mahhov