Skip to content

First and only battery on linux isn't always BAT0 #1238

@luzader

Description

@luzader

The battery on my laptop is "BAT1" and there is no "BAT0". So this check will fail:

psutil/psutil/_pslinux.py

Lines 1220 to 1221 in f0094db

root = os.path.join(POWER_SUPPLY_PATH, "BAT0")
if not os.path.exists(root):

It's possible this is an oddity of just my laptop (it doesn't have a second battery bay or anything exotic), but I wanted to point it out in case perhaps this is failing for others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions