System Information

Serge Orlov Serge.Orlov at gmail.com
Sun Mar 19 20:28:27 EST 2006


MidiBot at gmail.com wrote:
> in the online-documentation for this and had no luck. I imagine it is
> quite easy and may even be as simple as a boolean variable...?

In general it's not so simple, since a computer can have many power
sources.

> All I want to be able to tell is whether or not my computer is being
> externally powered. More specifically
> I want to be able to have my program running, and be alerted if I
> un-plug my power adapter.
>
> I am using a Mac(powerbook) with if that makes any
> difference.

It makes big difference, device API on different operating systems is
*absolutely* different. On Mac OS X, start from ioreg:
  http://www.hmug.org/man/8/ioreg.php,
also take a look at command line utility for querying battery info:
  http://www.mitt-eget.com/software/macosx/
These two pages should help you get started.

  -- Serge.




More information about the Python-list mailing list