def external_script(script, p1, p2, p3=None, p4=None):
 command = [script, p1, p2, p3, p4]
 try:
  (stup, need_shell, command, creationflags) = build_command(command)
  env = fix_env()
  logging.info('Running user script %s(%s, %s)', script, p1, p2)
  p = subprocess.Popen(command, shell=need_shell, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=stup, env=env, creationflags=creationflags)
 except:
  logging.debug('Failed script %s, Traceback: ', script, exc_info=True)
  return (('Cannot run script %s\r\n' % script), (-1))
 output = p.stdout.read()
 ret = p.wait()
 return (output, ret)

def external_script ( script , p1 , p2 , p3 = None , p4 = None ) : command = [ script , p1 , p2 , p3 , p4 ] try : ( stup , need_shell , command , creationflags ) = build_command ( command ) env = fix_env ( ) logging . info ( 'Running user script %s(%s, %s)' , script , p1 , p2 ) p = subprocess . Popen ( command , shell = need_shell , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , startupinfo = stup , env = env , creationflags = creationflags ) except : logging . debug ( 'Failed script %s, Traceback: ' , script , exc_info = True ) return ( ( 'Cannot run script %s\r\n' % script ) , ( - 1 ) ) output = p . stdout . read ( ) ret = p . wait ( ) return ( output , ret )
run a user script with two parameters .