Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.4 - On Glances startup "ERROR -- Can not init battery class ([WinError 3]" even though sensors plugin disabled #2776

Closed
AnthonyBe opened this issue May 16, 2024 · 3 comments
Labels
Milestone

Comments

@AnthonyBe
Copy link

Describe the bug
On Glances 4.0.4 start-up, and the following error is logged:
ERROR -- Can not init battery class ([WinError 3] The system cannot find the path specified: '/sys/class/power_supply')
even though the containers plugin is disabled.
Glances continues to run without issue so low priority issue. It just seems odd that with the sensors plugin disabled, it is obviously still trying to load something?

To Reproduce
Steps to reproduce the behavior:

  1. Start Glances with the following options glances -w --fs-free-space --enable-process-extended --config %APPDATA%\glances\glances.conf
  2. glances.conf contains:
[sensors]
disable=True
  1. The error is logged on start-up only.
2024-05-16 13:54:16,477 -- WARNING -- PsUtil can not grab processes gids ('Process' object has no attribute 'gids')
2024-05-16 13:54:16,477 -- INFO -- Start Glances 4.0.4
2024-05-16 13:54:16,493 -- INFO -- CPython 3.12.3 (C:\Python312\python.exe) and psutil 5.9.8 detected
2024-05-16 13:54:16,524 -- INFO -- Read configuration file 'C:\Users\Administrator\AppData\Roaming\glances\glances.conf'
2024-05-16 13:54:19,146 -- INFO -- Start GlancesWebServer mode
2024-05-16 13:54:20,292 -- ERROR -- containers (Docker) plugin - Can't connect to Docker (Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.'))
2024-05-16 13:54:20,481 -- ERROR -- Can not init battery class ([WinError 3] The system cannot find the path specified: '/sys/class/power_supply')
2024-05-16 13:54:24,329 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2024-05-16 13:54:24,329 -- INFO -- Get WebUI in C:\Python312\Lib\site-packages\glances\outputs\static/public
2024-05-16 13:54:24,329 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/

Expected behavior
no sensors code loading and therefore no error logged

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information)

  • Operating System (lsb_release -a or OS name/version): Windows Server 2016
  • Glances & psutil versions: Glances version: 4.0.4, PsUtil version: 5.9.8
  • How do you install Glances (Pypi package, script, package manager, source): Pypi package
  • Glances test (only available with Glances 3.1.7 or higher):
To be completed with result of: glances --issue
C:\WINDOWS\system32>glances --issue
===============================================================================
Glances �[94m4.0.4�[0m (C:\Python312\Lib\site-packages\glances\__init__.py)
Python �[94m3.12.3�[0m (C:\Python312\python.exe)
PsUtil �[94m5.9.8�[0m (C:\Python312\Lib\site-packages\psutil\__init__.py)
===============================================================================
�[94malert         �[92m[OK]   �[94m 0.00000s
�[0m[]�[0m
�[94mamps          �[92m[OK]   �[94m 0.00000s �[93mkey=name �[0m
[{'count': 0,
 'countmax': None,
 'countmin': 1.0,
 'key': 'name',
 'name': 'Dropbox',
 'refresh': 3.0,
 'regex': True,
 'result': None,
 'timer': 5.043111801147461}, ...]�[0m
�[94mcloud�[0m         [NA]�[0m�[0m
�[94mconnections�[0m   [NA]�[0m�[0m
�[94mcontainers�[0m    [NA]�[0m�[0m
�[94mcore          �[92m[OK]   �[94m 0.00000s
�[0m{'log': 2, 'phys': 2}�[0m
�[94mcpu           �[92m[OK]   �[94m 0.00000s
�[0m{'cpucore': 2,
'ctx_switches': 3188,
'ctx_switches_gauge': 9947357,
'ctx_switches_rate_per_sec': 1577.0,
'dpc': 0.0,
'idle': 97.7,
'interrupts': 3055,
'interrupts_gauge': 10091286,
'interrupts_rate_per_sec': 1511.0,
'soft_interrupts': 0,
'soft_interrupts_gauge': 0,
'soft_interrupts_rate_per_sec': 0.0,
'syscalls': 8936,
'syscalls_gauge': 73725888,
'syscalls_rate_per_sec': 4421.0,
'system': 0.8,
'time_since_update': 2.021165370941162,
'total': 30.3,
'user': 1.6}�[0m
�[94mdiskio        �[92m[OK]   �[94m 0.00000s �[93mkey=disk_name �[0m
[{'disk_name': 'PhysicalDrive0',
 'key': 'disk_name',
 'read_bytes': 692224,
 'read_bytes_gauge': 7445936128,
 'read_bytes_rate_per_sec': 342487.0,
 'read_count': 139,
 'read_count_gauge': 288206,
 'read_count_rate_per_sec': 68.0,
 'time_since_update': 2.021165370941162,
 'write_bytes': 1449984,
 'write_bytes_gauge': 6838657536,
 'write_bytes_rate_per_sec': 717399.0,
 'write_count': 178,
 'write_count_gauge': 470832,
 'write_count_rate_per_sec': 88.0}, ...]�[0m
�[94mfolders�[0m       [NA]�[0m�[0m
�[94mfs            �[92m[OK]   �[94m 0.01559s �[93mkey=mnt_point �[0m
[{'device_name': 'C:\\',
 'free': 213466804224,
 'fs_type': 'NTFS',
 'key': 'mnt_point',
 'mnt_point': 'C:\\',
 'percent': 61.1,
 'size': 549048020992,
 'used': 335581216768}, ...]�[0m
�[94mgpu�[0m           [NA]�[0m�[0m
�[94mhelp          �[92m[OK]   �[94m 0.00000s
�[0mNone�[0m
�[94mip            �[92m[OK]   �[94m 2.03416s
�[0m{'address': '***', 'gateway': '***', 'mask': '***', 'mask_cidr': '***'}�[0m
�[94mirq�[0m           [NA]�[0m�[0m
�[94mload          �[92m[OK]   �[94m 0.00000s
�[0m{'cpucore': 2, 'min1': 0.08, 'min15': 0.01, 'min5': 0.02}�[0m
�[94mmem           �[92m[OK]   �[94m 0.00000s
�[0m{'available': 7180079104, 'free': 7180079104, 'percent': 58.1, 'total': 17143681024, 'used': 9963601920}�[0m
�[94mmemswap       �[92m[OK]   �[94m 0.00000s
�[0m{'free': 2296844288,
'percent': 9.9,
'sin': 0,
'sout': 0,
'time_since_update': 5.98190450668335,
'total': 2550136832,
'used': 253292544}�[0m
�[94mnetwork       �[92m[OK]   �[94m 0.01563s �[93mkey=interface_name �[0m
[{'alias': None,
 'bytes_all': 0,
 'bytes_all_gauge': 0,
 'bytes_all_rate_per_sec': 0.0,
 'bytes_recv': 0,
 'bytes_recv_gauge': 0,
 'bytes_recv_rate_per_sec': 0.0,
 'bytes_sent': 0,
 'bytes_sent_gauge': 0,
 'bytes_sent_rate_per_sec': 0.0,
 'interface_name': 'Ethernet 2',
 'key': 'interface_name',
 'speed': 0,
 'time_since_update': 4.07091760635376}, ...]�[0m
�[94mnow           �[92m[OK]   �[94m 0.00000s
�[0m{'custom': '2024-05-16 14:02:46 +1000', 'iso': '2024-05-16T14:02:46+10:00'}�[0m
�[94mpercpu        �[92m[OK]   �[94m 0.00000s �[93mkey=cpu_number �[0m
[{'cpu_number': 0, 'idle': 63.1, 'key': 'cpu_number', 'system': 8.4, 'total': 36.9, 'user': 26.7}, ...]�[0m
�[94mports         �[92m[OK]   �[94m 0.00000s �[93mkey=indice �[0m
[{'description': 'DefaultGateway',
 'host': '192.168.0.1',
 'indice': 'port_0',
 'key': 'indice',
 'port': 0,
 'refresh': 30,
 'rtt_warning': None,
 'status': 0.126356,
 'timeout': 3}, ...]�[0m
�[94mprocesscount  �[92m[OK]   �[94m 0.12500s
�[0m{'pid_max': 0, 'running': 83, 'sleeping': 0, 'thread': 1013, 'total': 85}�[0m
�[94mprocesslist   �[92m[OK]   �[94m 0.00000s
�[0m[]�[0m
�[94mpsutilversion �[92m[OK]   �[94m 0.00000s
�[0m'5.9.8'�[0m
�[94mquicklook     �[92m[OK]   �[94m 0.00000s
�[0m{'cpu': 30.3,
'cpu_hz': 2500000000.0,
'cpu_hz_current': 2125000000.0,
'cpu_log_core': 2,
'cpu_name': 'CPU',
'cpu_phys_core': 2,
'load': 0.5,
'mem': 58.1,
'percpu': [{...}, {...}],
'swap': 9.9}�[0m
�[94mraid�[0m          [NA]�[0m�[0m
�[94msensors�[0m       [NA]�[0m�[0m
�[94msmart�[0m         [NA]�[0m�[0m
�[94msystem        �[92m[OK]   �[94m 0.00000s
�[0m{'hostname': 'ANTMICROSERVER',
'hr_name': 'Windows 2016Server SP0 64bit',
'os_name': 'Windows',
'os_version': '2016Server SP0',
'platform': '64bit'}�[0m
�[94muptime        �[92m[OK]   �[94m 0.00000s
�[0m{'seconds': 6831}�[0m
�[94mversion       �[92m[OK]   �[94m 0.00000s
�[0m'4.0.4'�[0m
�[94mwifi�[0m          [NA]�[0m�[0m
===============================================================================
Total time to update all stats: �[94m2.19037s�[0m
===============================================================================

Additional context
n/a

You can also pastebin:

@AnthonyBe AnthonyBe changed the title 4.0.4 - On Glances startup "ERROR -- Can not init battery class ([WinError 3]" 4.0.4 - On Glances startup "ERROR -- Can not init battery class ([WinError 3]" even though sensors plugin disabled May 16, 2024
@nicolargo nicolargo added the bug label May 16, 2024
@nicolargo
Copy link
Owner

Hi @AnthonyBe thanks for the issue report.

It's a bug, on Windows OS, the file /sys/class/power_supply do not exist and should be ignore.

@AnthonyBe
Copy link
Author

Copy that!

@nicolargo nicolargo added this to the Glances 4.0.5 milestone May 16, 2024
nicolargo added a commit that referenced this issue May 16, 2024
@nicolargo
Copy link
Owner

Corrected in the develop branch.

Will be released in Glances 4.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants