2017-04-19 37 views
0
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脚本是正确的,还是应该使用嵌入for循环的Linux shell?如何在For循环调用Shell脚本中转​​义Python名称错误?

+4

您应该修复您的缩进。 – user2314737

+1

你还没有调用你的startdataprocessing函数。 – Bemmu

+0

您正在调用'text_file',它是*'startdataprocessing'内定义的变量* – jmk

回答

0

在脚本

text_file = open("SRAIdFromPythonInput.txt", "w") 
for item in text_file: 
    execute('bash ./oneclickdataprocessor.sh') 
text_file.close() 

方面调用外部外壳文件考虑subprocess模块。更多内容this question

相关问题