x = open('data.txt', 'a')
g = open('graphing_data.txt', 'a')
subprocess.call(['sfit4Layer0.py', '-bv5', '-fh']) # only need to do this once
with open('filenames.txt', 'r') as r:
for line in r:
opusfile = line.strip()
subprocess.call(['ckopus', '-FSNGC', '-SFL0', '-u6', opusfile])
subprocess.call(['sfit4Layer0.py', '-bv5', '-fp'])
subprocess.call(['sfit4Layer0.py', '-bv5', '-fs'])
# now summary file is produced so must write in summary file code here
for infile in glob.glob(os.path.join(road, 'summary*')):
#write data from summary to data.txt and graphing_data.txt
x.close()
g.close()
我有一个程序,它需要将上面subprocess.call
行中的命令写入终端来处理数据文件,所以我想我应该编写一个程序来自动执行(我有100多个数据文件)。我的程序参考文件名.txt使用一个文件名列表,并将它们作为opusfile读入,以便用第一个命令执行。它似乎正确地处理了第一个文件,然后我得到了这个错误:
我尝试过理解subprocess模块,但它有点让我困惑,如果有人有提示或链接到一个非常好的坚实教程-我是相当新的Python。在
目前没有回答
相关问题 更多 >
编程相关推荐