GNOME Bugzilla – Bug 644701
can't start the d-feet after the previous start
Last modified: 2011-11-14 19:21:28 UTC
$ d-feet ** (d-feet:12529): WARNING **: Trying to register gtype 'WnckWindowState' as enum when in fact it is of type 'GFlags' ** (d-feet:12529): WARNING **: Trying to register gtype 'WnckWindowActions' as enum when in fact it is of type 'GFlags' ** (d-feet:12529): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as enum when in fact it is of type 'GFlags' Traceback (most recent call last):
+ Trace 226306
app = DFeetApp.DFeetApp()
settings = Settings.get_instance()
cls.instance = Settings()
self.read()
self.config.read(self.filename)
self._read(fp, filename)
raise e
[line 5]: 'windowstate\n' And I viewed the config file [General] windowheight = 970 windowwidth = 1280 bustabs_list = System Bus windowstate
I use the 11.4 now, and I found in 11.3 the value was set correctly. windowstate = None So what's the code affected?
I found the reason /usr/lib/python2.7/ConfigParser.py if value is None: fp.write("%s\n" % (key)) else: fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) When the value is None, it'll process it without '='.
so,we can check the python version and change the behavior of saving config diff --git a/dfeet/settings.py b/dfeet/settings.py index 35edfe3..223dacd 100644 --- a/dfeet/settings.py +++ b/dfeet/settings.py @@ -8,6 +8,7 @@ import ConfigParser import os import re +import sys class ConfigTokenizer(): COMMA = re.compile(",") @@ -106,6 +107,11 @@ class Settings: filename -- path to the settings file. If None, the default ~/.dfeet/config will be used. """ + if sys.version_info[:2]==(2,7): + self.version2_7=True + else: + self.version2_7=False + if not filename: self.filename = os.path.expanduser("~/.d-feet/config") else: @@ -163,6 +169,9 @@ class Settings: self.general[key][i] = self.quote(self.general[key][i]) self.general[key] = ','.join(self.general[key]) + if self.general[key] == None and self.version2_7: + self.general[key] = '' + self.config.set("General", key, self.general[key]) # make sure that the directory that the config file is in exists
John, The patch now works fine for, could let it in upstream? Thanks!
hmm, I wonder if this is fixed upstream already. I haven't had a release in awhile. In any case this fix should work in any version. No need to check. I'll add it as if self.general[key] == None: self.general[key] = '' and do a release
released 0.1.14