def startdataprocessing (self, widget):
text_file = open("SRAIdFromPythonInput.txt", "w")
for item in text_file:
execute('bash ./oneclickdataprocessor.sh')
text_file.close()
我有错误text_file未定义。如何解决?在.txt文件中的每个项目上调用.sh脚本是否正确,或者我应该使用Linux shell嵌入for循环?
答案 0 :(得分:0)
就你的剧本而言
text_file = open("SRAIdFromPythonInput.txt", "w")
for item in text_file:
execute('bash ./oneclickdataprocessor.sh')
text_file.close()
要调用外部shell文件,请考虑subprocess模块。更多this question