def grab_doc(cmd, trap_error=True):
 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
 (stdout, stderr) = proc.communicate()
 if (trap_error and proc.returncode):
  msg = (u'Attempting to run %s. Returned Error: %s' % (cmd, stderr))
  raise IOError(msg)
 if stderr:
  return stderr
 return stdout

def grab_doc ( cmd , trap_error = True ) : proc = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE , shell = True ) ( stdout , stderr ) = proc . communicate ( ) if ( trap_error and proc . returncode ) : msg = ( u'Attempting to run %s. Returned Error: %s' % ( cmd , stderr ) ) raise IOError ( msg ) if stderr : return stderr return stdout
run cmd without args and grab documentation .