def exec_python(pycode):
 env = copy.deepcopy(os.environ)
 env['PATH'] = _env_path
 out = subprocess.Popen([_pyexe, '-c', pycode], env=env, stdout=subprocess.PIPE, shell=False).stdout.read()
 out = out.decode('ascii').strip()
 return out

def exec_python ( pycode ) : env = copy . deepcopy ( os . environ ) env [ 'PATH' ] = _env_path out = subprocess . Popen ( [ _pyexe , '-c' , pycode ] , env = env , stdout = subprocess . PIPE , shell = False ) . stdout . read ( ) out = out . decode ( 'ascii' ) . strip ( ) return out
wrap running python script in a subprocess .