Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

charclo

macrumors newbie
Original poster
Aug 25, 2010
1
0
Hi,

Does anybody know how to get info on the battery of a macbook in python or PyObj? Or maybe ObjC so I can wrap it in python?
I need the battery percentage and if the battery is charging, discharging or charged.

I can do
Code:
import subprocess

process = subprocess.Popen(['pmset', '-g', 'pslog'], shell=False, stdout=subprocess.PIPE)
print process.stdout.readline()
but I'm looking for something more pythonic

Thanks,
Charclo
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.