New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Battery info on macbook


Post Reply New Thread Subscribe

 
Thread Tools
charclo

 
Member Since: Aug 25, 2010
Posts: 1
charclo is on a distinguished road

charclo is offline
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
QUOTE Thanks

Post Reply New Thread Subscribe


« Application testing tools - need advice | Making a Shell Script Executable »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Macbook Pro battery powers down at random AJCardy Apple Notebooks 2 07-08-2010 11:47 PM
MacBook Pro just DIED after battery replacement and callibration ! Doug b Apple Notebooks 14 11-25-2009 06:00 AM
New Macbook pro 17" battery life? onefastack Apple Notebooks 7 08-26-2009 05:21 PM

All times are GMT -4. The time now is 08:12 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?