Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.28 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import subprocess
  2.  
  3. class MyOwnKeywords(object):
  4.     def run_cmd(self, cmd):
  5.         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  6.         output = p.communicate()[0]
  7.         if p.wait() != 0:
  8.             print "*WARN* %s failed" %cmd
  9.         return output