question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Crash when connecting/disconnecting power adapter

See original GitHub issue

Describe the bug

When running bpytop on Debian Testing and with the battery-mode enabled, bpytop crashes when I connect or disconnect my power adapter.

Info (please complete the following information):

  • bpytop version: 1.0.27
  • psutil version: 5.7.2
  • (Linux) Linux distribution and version: Debian Testing
  • Terminal used: zsh
  • Python version: 3.8.5

Additional context

contents of ~/.config/bpytop/error.log

12/09/20 (13:16:48) | INFO: New instance of bpytop version 1.0.27 started with pid 297438
12/09/20 (13:16:48) | INFO: Loglevel set to INFO
12/09/20 (13:17:32) | ERROR: Data collection thread failed with exception: 'NoneType' object has no attribute 'percent'
Traceback (most recent call last):
  File "/usr/local/bin/bpytop", line 2503, in _runner
    collector._draw()
  File "/usr/local/bin/bpytop", line 2705, in _draw
    CpuBox._draw_fg()
  File "/usr/local/bin/bpytop", line 1636, in _draw_fg
    if CONFIG.show_battery and cls.battery_present and psutil.sensors_battery().percent != cls.battery_percent:
AttributeError: 'NoneType' object has no attribute 'percent'
12/09/20 (13:17:33) | WARNING: Exiting with errorcode (1). Runtime 0:00:45

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
aristocratoscommented, Sep 12, 2020

Yeah, just noticed from psutil documentation:

secsleft: a rough approximation of how many seconds are left before the battery runs out of power. If the AC power cable is connected this is set to psutil.POWER_TIME_UNLIMITED. If it can’t be determined it is set to psutil.POWER_TIME_UNKNOWN.

Will add a check to hide if the value is negative.

0reactions
aristocratoscommented, Sep 12, 2020

@delta-one Fixed in v1.0.30 Hopefully last fix for this 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laptop crashes when power cord is unplugged
Almost every time when I unplug power cord and I have open program my laptop freezes for about 3-4 seconds then it comes...
Read more >
Windows crashed after charger disconnecte…
Once I unplug and disconnects the charger from my laptop and tries to use the Battery, for some reason. Windows not responding and...
Read more >
Windows 10 crashes when laptop is connected to charger
Unplug the AC power adapter. Press and hold the Power button down for 15 seconds. This will perform a software battery reset that...
Read more >
Laptop crashes when power cord is unplugged - Windows 7
Whenever I unplug the power cord, laptops were crashing with blue screen. Issue was not resolved even after updating the graphics driver.
Read more >
Laptop crashes and restarts after unplugging charger
Laptop simply crashes whenever I unplug the charger. Upon restart, windows says it encountered an error, blah blah blah, would - 4605574.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found