vagnum08 / cpupower-gui

cpupower-gui is a graphical program that is used to change the scaling frequency limits of the cpu, similar to cpupower.
GNU General Public License v3.0
476 stars 31 forks source link

Version 0.9.0 fails to start #30

Closed unode closed 4 years ago

unode commented 4 years ago

Hi @vagnum08

When launching version 0.9.0 built from git (tag v0.9.0), I get:

% cpupower-gui
Traceback (most recent call last):
  File "/nix/store/96l1iirm7i91211a3c3xl2ysam3y83b8-cpupower-gui-0.9.0/bin/.cpupower-gui-wrapped", line 126, in <module>
    conf = CpuPowerConfig()
  File "/nix/store/96l1iirm7i91211a3c3xl2ysam3y83b8-cpupower-gui-0.9.0/share/cpupower-gui/cpupower_gui/config.py", line 45, in __init__
    self._read_profiles()
  File "/nix/store/96l1iirm7i91211a3c3xl2ysam3y83b8-cpupower-gui-0.9.0/share/cpupower-gui/cpupower_gui/config.py", line 69, in _read_profiles
    files = self.user_conf.glob("*.profile")
AttributeError: 'NoneType' object has no attribute 'glob'

running with Python 3.7.

I didn't do anything other than installing 0.9.0 and launching it. 0.8.0 still runs fine.

Setup (please complete the following information):

vagnum08 commented 4 years ago

Hi @unode, this one should be trivial to fix.

There is a temporary fix from your side while I am fixing it in master. I assume you haven't added the pyxdg as a dependency and is not installed. If xdg is missing XGD_PATH and user_conf are None. https://github.com/vagnum08/cpupower-gui/blob/f323899e0953767b37d2adc07a88bda887eb675f/cpupower_gui/config.py#L13

You can add xdg for now as a required dependency instead of a suggested one. In the meantime I will add a check so it doesn't fail if is not set.

Give it a try and let me know

unode commented 4 years ago

Added pyxdg but get a different error:

Traceback (most recent call last):
  File "/nix/store/f351fqb3g8cnns701vrs7rsrmbj0ysg2-cpupower-gui-0.9.1/bin/.cpupower-gui-wrapped", line 192, in <module>
    from cpupower_gui import main
  File "/nix/store/f351fqb3g8cnns701vrs7rsrmbj0ysg2-cpupower-gui-0.9.1/share/cpupower-gui/cpupower_gui/main.py", line 32, in <module>
    gi.require_version("AppIndicator3", "0.1")
  File "/nix/store/74m737h8prjz7ry61xr30ngqcgr1w84g-python3.7-pygobject-3.34.0/lib/python3.7/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AppIndicator3 not available

Before I had a file ~/.config/cpupower_gui/99-allcpus.conf with the contents discussed in #24 and got a different exception. The error on this one was clear and adding a line [GUI] solved it:

Traceback (most recent call last):
  File "/nix/store/f351fqb3g8cnns701vrs7rsrmbj0ysg2-cpupower-gui-0.9.1/bin/.cpupower-gui-wrapped", line 126, in <module>
    conf = CpuPowerConfig()
  File "/nix/store/f351fqb3g8cnns701vrs7rsrmbj0ysg2-cpupower-gui-0.9.1/share/cpupower-gui/cpupower_gui/config.py", line 44, in __init__
    self._read_configuration()
  File "/nix/store/f351fqb3g8cnns701vrs7rsrmbj0ysg2-cpupower-gui-0.9.1/share/cpupower-gui/cpupower_gui/config.py", line 65, in _read_configuration
    self.config.read(conf_files)
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/configparser.py", line 696, in read
    self._read(fp, filename)
  File "/nix/store/r94aa2gj4drkhfvkm2p4ab6cblb6kxlq-python3-3.7.6/lib/python3.7/configparser.py", line 1079, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: PosixPath('/home/u/.config/cpupower_gui/99-allcpus.conf'), line: 1
'allcpus_default=True\n'

Hunting down libappindicator to see if it helps.

unode commented 4 years ago

Adding libappindicator as a dependency fixes the last issue. It's now running fine.

Offtopic: I noticed that the frequencies are now floats instead of integers which makes the last digit get slightly covered.

screenshot_2020-10-15_19-28-43_083705911

Thanks for the quick reply!

vagnum08 commented 4 years ago

Appindicator is currently required.

I had a quick test, it worked as expected. Could you try installing commit 42c8835 and see if it works. I also noticed that I wasn't reading any profile files from /ect/cpupower_gui.d/. I fixed that too.

Offtopic: As for the 99-allcpus-default.conf, yes the sections are required. The main config file(cpupower_gui.conf) will always have all the options available so users can copy a subset for their overrides.

For the digits, apparently it depends on theming. I had the same issue initially. However, I added some space. I will have a look.

unode commented 4 years ago

https://github.com/vagnum08/cpupower-gui/commit/42c883577989c3291a5d5550bc0eb8508af8877e works here too, with and without pyxdg.

vagnum08 commented 4 years ago

About the appindicator, I had a simple except clause and now added ImportError however gi.require_version raises ValueError.

So appindicator would be optional.