Friday 15 February 2013

linux - Python subprocess and os.system both not working when sourcing a file -



linux - Python subprocess and os.system both not working when sourcing a file -

so, trying execute next command on python:

project = "7.0" cmd = ". envvarsettingfile %s; echo $release" %project os.system(cmd)

here dilemma. envvarsettingfile script takes in argument(project in case) , sets environment variable "release" , exports it. however, when seek execute above command, python complains saying argument not passed. , leads echo $release not printing out anything.

i tried checking on unix command line , works perfectly. sets environ variable , prints "release" variable. however, reason, doesn't seem work in python. note have tried using subprocess.call(cmd, shell=true) , doesn't anything. also, when executing python script contains code, gets stuck right @ os.system(cmd) , have kill process manually.

python linux unix subprocess os.system

No comments:

Post a Comment