Reputation: 363
Trying to use Python for more than text parsing and figure the best way is to write a script I will find useful. I'm having an issue though I get an error when making the call.
from subprocess import call
call (["powercfg", "/batteryreport"])
The error I receive is the following:
An unexpected error condition has occurred. Unable to perform operation. You may not have permission to perform this operation.
I've run the command prompt under elevated user privileges as well with no dice. Any help would be appreciated.
Note: For those unfamiliar this command creates an HTML file of your battery use on Windows in your user directory (C:\Users\Name).
Upvotes: 2
Views: 1322
Reputation: 20317
Perhaps you can use the full path to powercfg.exe?
Perhaps you can call([ ... ], shell=True)?
Perhaps you can check the return value of call()?
Upvotes: 0