def shellCall(shellCmd, stdin='', stderr=False):
 if (type(shellCmd) == str):
  shellCmdList = shlex.split(shellCmd)
 elif (type(shellCmd) in (list, tuple)):
  shellCmdList = shellCmd
 else:
  return (None, 'shellCmd requires a list or string')
 proc = subprocess.Popen(shellCmdList, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 (stdoutData, stderrData) = proc.communicate(stdin)
 del proc
 if stderr:
  return (stdoutData.strip(), stderrData.strip())
 else:
  return stdoutData.strip()

def shellCall ( shellCmd , stdin = '' , stderr = False ) : if ( type ( shellCmd ) == str ) : shellCmdList = shlex . split ( shellCmd ) elif ( type ( shellCmd ) in ( list , tuple ) ) : shellCmdList = shellCmd else : return ( None , 'shellCmd requires a list or string' ) proc = subprocess . Popen ( shellCmdList , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( stdoutData , stderrData ) = proc . communicate ( stdin ) del proc if stderr : return ( stdoutData . strip ( ) , stderrData . strip ( ) ) else : return stdoutData . strip ( )
call a single system command with arguments .