Using commands
module (Preferred):
from commands import getoutput
getoutput('sleep 50; xrandr --output VGA1 --gamma 1.28:1:1.28')
Using os.system
module:
import os
os.system('sleep 50; xrandr --output VGA1 --gamma 1.28:1:1.28')
os.system
will shell out and run the command without a way to capture the output. Avoid using this, even if you don't care about the output, the commands
module is much better.
commands
has two methods that can run and return the output:
- getoutput - will run the command and return the output
- getstatusoutput - will run the command and return the status code and the output