无法在python脚本中发出shell命令的结果

时间:2016-09-28 08:59:19

标签: python shell

我正在尝试运行shell命令,该命令将输出转换为python脚本中的某个文件但是当我看到tee输出的日志文件时它是空的。代码如下所示:

val_home =  os.environ["xyz"]
pwd = os.getcwd()
os.chdir(val_home)
os.chdir("..")
avk_home = os.environ["abc"]
del os.environ['abc']
command = "source %s/somefile/ %s/inputparamater | tee config.log" %(val_home,val_home)
execute(command)#function written to execute shell command ,no issue with this
assert search_string("config.log","Success") ,"Target config failed"
rm_file(['config.log'])
os.environ["AVKRUN_HOME"] = avk_home
os.chdir(pwd)

文件config.out为空,但当我手动运行命令时,我看到了tee文件输出。

0 个答案:

没有答案