Bug 204938

Summary: guidance-power-manager crashes on startup with a TypeError (Patch attached)
Product: [Frameworks and Libraries] guidance-power-manager Reporter: Søren Færløv <cthulhu>
Component: generalAssignee: Jonathan Riddell <jr>
Status: RESOLVED FIXED    
Severity: crash CC: echidnaman, m.heiming
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: guidance-power-manager-4.3.0-fix-typeerror.patch

Description Søren Færløv 2009-08-24 08:21:48 UTC
Version:            (using KDE 4.3.0)
Compiler:          GCC 4.4.1 Python 2.6.2
OS:                Linux
Installed from:    Gentoo Packages

When running guidance-power-manager it crashes with the following traceback:

Traceback (most recent call last):
  File "/usr/bin/guidance-power-manager", line 1178, in <module>
    main()
  File "/usr/bin/guidance-power-manager", line 1153, in main
    mainWindow = PowermanagerApp(None)
  File "/usr/bin/guidance-power-manager", line 1077, in __init__
    self.pmwidget.prepare()
  File "/usr/bin/guidance-power-manager", line 89, in prepare
    self.configToUi()
  File "/usr/bin/guidance-power-manager", line 410, in configToUi
    self._setCB(self.BatteryCriticalCombo, self.cb_act,
self.cb_act_def_critical,
self._checkOldConfig(self.config.readEntry("batteryCriticalAction", ""),
False))
  File "/usr/bin/guidance-power-manager", line 163, in _checkOldConfig
    num_val = int(value)
TypeError: int() argument must be a string or a number, not 'QVariant'
nano /usr/bin/guidance-power-manager
[1]+  Exit 255                guidance-power-manager

I'm not sure what the exact cause is, but I'm using Python-2.6.2. As far as I can tell, the error occurs while trying to convert an old configuration file.
It is easily fixed, by replacing the offending line, /usr/bin/guidance-power-manager:163
     num_val = int(value)
with
     num_val = value.toInt()
Comment 1 Søren Færløv 2009-08-24 08:25:05 UTC
Created attachment 36401 [details]
guidance-power-manager-4.3.0-fix-typeerror.patch

Please ignore the -r1 part of the version number. It's simply my own revision version, since I've created my own Gentoo ebuild, that applies the patch.
Comment 2 M. Heiming 2009-08-28 20:24:39 UTC
Have exactly the same bug on Fedora 10, which showed up a few days ago after the latest updates were installed.

$ lsb_release -d
Description:    Fedora release 10 (Cambridge)

$ rpm -qf `which guidance-power-manager`
guidance-power-manager-4.2.3-1.fc10.i386

Your solution works nicely for me.

Thx a bunch

Michael Heiming
Comment 3 Jonathan Thomas 2009-09-09 00:31:56 UTC
Fixed in svn: http://websvn.kde.org/?view=rev&revision=1006777