Thank you. I'll look at subprocess. I have since found that commands will do it too, eg, (status, txt) = commands.getstatusoutput('whoami') or txt = commands.getoutput('whoami')