tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.2k stars 229 forks source link

Modules no more working : cpu,cpu2,caffeine #946

Closed Tonus1 closed 1 year ago

Tonus1 commented 1 year ago

Bug Report

Description

Affected module: cpu,cpu2,caffeine Version used: 2.1.6 from Slackbuilds.org

Get errors when I add these modules :

/usr/bin/bumblebee-status -m caffeine -d
[2023-01-02 04:28:07,911] input            DEBUG    registering callback ::wheel-up
[2023-01-02 04:28:07,912] input            DEBUG    registering callback ::wheel-down
{"version": 1, "click_events": true}
[
[2023-01-02 04:28:07,913] module           DEBUG    importing debug from core
[2023-01-02 04:28:07,913] module           WARNING  failed to import caffeine from core: No module named 'modules.core.caffeine'
{"version":1}
[
[{"full_text": " module 'psutil._psutil_posix' has no attribute 'getpagesize' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],

or

/usr/bin/bumblebee-status -m cpu2 -d
[2023-01-02 04:27:52,063] input            DEBUG    registering callback ::wheel-up
[2023-01-02 04:27:52,063] input            DEBUG    registering callback ::wheel-down
{"version": 1, "click_events": true}
[
[2023-01-02 04:27:52,064] module           DEBUG    importing debug from core
[2023-01-02 04:27:52,064] module           WARNING  failed to import cpu2 from core: No module named 'modules.core.cpu2'
{"version":1}
[
[{"full_text": " module 'psutil._psutil_posix' has no attribute 'getpagesize' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],
[{"full_text": " module 'psutil._psutil_posix' has no attribute 'getpagesize' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],
[{"full_text": " module 'psutil._psutil_posix' has no attribute 'getpagesize' ", "background": "#ff0000", "color": "#ffffff", "name": "error", "instance": "the-only-one"}],

How to reproduce

Install bumblebee-status and module dependencies (wheel-0.37.1, python3-installer-0.5.1, python3-pep517-0.12.0, python3-build-0.7.0, python3-psutil-5.9.4). Add cpu, cpu2 or caffeine module, reload i3wm config.

tobi-wan-kenobi commented 1 year ago

This seems to be some issue with psutil, but I don't understand it, brcause that is an internal function call.

Will need to do some more investigation.

Tonus1 commented 1 year ago

According to the docs here :

psutil.pid_exists(pid)
Check whether the given PID exists in the current process list. This is faster than doing `pid in psutil.pids()` and should be preferred.

and might have been some changes occuring for psutil.process_iter(attrs=None, ad_value=None) :

Changed in version 5.3.0: added “attrs” and “ad_value” parameters.
tobi-wan-kenobi commented 1 year ago

Good point reg. the pid_exists(), but I don't think this is the issue, because cpu, for example, only uses the cpu_percentage() call. Also, I happen to have the exact same version of psutil installed (5.4.9) and all three modules work for me.

Just to be 100% sure, can you please try the following:

In a shell, enter /usr/bin/env python3 - this should drop you into an interactive shell.

Next, enter import psutil, followed by psutil.__version__, and please report the output.

Then, finally, please try psutil.cpu_percent(percpu=False) and let me know the result of that.

Thank you very much in advance!

Tonus1 commented 1 year ago

Facepalm here ! Your questions and the error I had while importing psutil made me look at all the packages related : I had an old package without prefix python3- that was interfering and wouldn't be updated with the good python3-psutil ! Sorry for the noise ! I still learn not to post in the middle of the night...

tobi-wan-kenobi commented 1 year ago

Glad this is resolved - and no worries, Python packaging is a really bad mess, in my opinion.