def __exec_python_cmd(cmd, env=None):
 from ...config import CONF
 if (env is None):
  env = {}
 pp_env = copy.deepcopy(os.environ)
 pp_env.update(env)
 pp = os.pathsep.join((CONF['pathex'] + [HOMEPATH]))
 if is_py2:
  if isinstance(pp, unicode):
   pp = pp.encode(sys.getfilesystemencoding())
 if ('PYTHONPATH' in pp_env):
  pp = os.pathsep.join([pp_env.get('PYTHONPATH'), pp])
 pp_env['PYTHONPATH'] = pp
 try:
  txt = exec_python(env=pp_env, *cmd)
 except OSError as e:
  raise SystemExit(('Execution failed: %s' % e))
 return txt.strip()

def __exec_python_cmd ( cmd , env = None ) : from ... config import CONF if ( env is None ) : env = { } pp_env = copy . deepcopy ( os . environ ) pp_env . update ( env ) pp = os . pathsep . join ( ( CONF [ 'pathex' ] + [ HOMEPATH ] ) ) if is_py2 : if isinstance ( pp , unicode ) : pp = pp . encode ( sys . getfilesystemencoding ( ) ) if ( 'PYTHONPATH' in pp_env ) : pp = os . pathsep . join ( [ pp_env . get ( 'PYTHONPATH' ) , pp ] ) pp_env [ 'PYTHONPATH' ] = pp try : txt = exec_python ( env = pp_env , * cmd ) except OSError as e : raise SystemExit ( ( 'Execution failed: %s' % e ) ) return txt . strip ( )
executes an externally spawned python interpreter and returns anything that was emitted in the standard output as a single string .