System Information

totalgeekdom at gmail.com totalgeekdom at gmail.com
Sun Mar 19 20:17:39 EST 2006


I'm not sure about osx, but I know linux uses a proc virtual
filesystem. ( freebsd is probably closer, and it doesn't either but you
can mount it via mount_linprocfs none /proc)

But if you know if you have a proc file system, you can check it to see
if you are under power...

IE if I remember right, on my laptop it would be
'/proc/acpi/battery/BAT1'
>From there I would grep / sed it until I got the results I wanted, then
do
if os.popen("cat /proc[...]") == 'power':
     [program]
else:
     print "not plugged in"



Not the prettiest of solutions, but it's worth a shot




More information about the Python-list mailing list