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

FreeBSD: sensors_battery() raises OSError in case of no battery #1074

Closed
giampaolo opened this issue May 16, 2017 · 0 comments
Closed

FreeBSD: sensors_battery() raises OSError in case of no battery #1074

giampaolo opened this issue May 16, 2017 · 0 comments

Comments

@giampaolo
Copy link
Owner

This was signaled by @glebius and it happens on a FreeBSD system with no battery. Fix consists in making sensors_battery return None instead.

#PYTHONPATH=/usr/src/psutil python2 psutil/tests/test_connections.py

Traceback (most recent call last):
  File "psutil/tests/test_connections.py", line 30, in <module>
    from psutil.tests import AF_UNIX
  File "/usr/src/psutil/psutil/tests/__init__.py", line 156, in <module>
    HAS_BATTERY = HAS_SENSORS_BATTERY and psutil.sensors_battery()
  File "/usr/src/psutil/psutil/__init__.py", line 2316, in sensors_battery
    return _psplatform.sensors_battery()
  File "/usr/src/psutil/psutil/_psbsd.py", line 411, in sensors_battery
    percent, minsleft, power_plugged = cext.sensors_battery()
OSError: [Errno 2] No such file or directory
asergi added a commit to nicolargo/glances that referenced this issue Feb 15, 2018
Issue #1055 has been fixed in psutil 5.3.0 (see giampaolo/psutil#1074).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant