After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 644701 - can't start the d-feet after the previous start
can't start the d-feet after the previous start
Status: RESOLVED FIXED
Product: d-feet
Classification: Other
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: johnp
Depends on:
Blocks:
 
 
Reported: 2011-03-14 09:18 UTC by Bin Li
Modified: 2011-11-14 19:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bin Li 2011-03-14 09:18:42 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):
  • File "/usr/bin/d-feet", line 49 in <module>
    app = DFeetApp.DFeetApp()
  • File "/usr/lib/python2.7/site-packages/dfeet/DFeetApp.py", line 28 in __init__
    settings = Settings.get_instance()
  • File "/usr/lib/python2.7/site-packages/dfeet/settings.py", line 48 in get_instance
    cls.instance = Settings()
  • File "/usr/lib/python2.7/site-packages/dfeet/settings.py", line 40 in __init__
    self.read()
  • File "/usr/lib/python2.7/site-packages/dfeet/settings.py", line 56 in read
    self.config.read(self.filename)
  • File "/usr/lib/python2.7/ConfigParser.py", line 297 in read
    self._read(fp, filename)
  • File "/usr/lib/python2.7/ConfigParser.py", line 536 in _read
    raise e
ConfigParser.ParsingError: File contains parsing errors: /home/charles/.d-feet/config
	[line  5]: 'windowstate\n'

And I viewed the config file

[General]
windowheight = 970
windowwidth = 1280
bustabs_list = System Bus
windowstate
Comment 1 Bin Li 2011-03-14 10:19:23 UTC
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?
Comment 2 Bin Li 2011-03-14 10:26:38 UTC
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 '='.
Comment 3 dongmao zhang 2011-08-12 05:46:22 UTC
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
Comment 4 Bin Li 2011-11-14 09:26:45 UTC
John,

 The patch now works fine for, could let it in upstream? Thanks!
Comment 5 johnp 2011-11-14 15:51:38 UTC
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
Comment 6 johnp 2011-11-14 19:21:28 UTC
released 0.1.14