繁体   English   中英

如何在for循环调用Shell脚本中转​​义Python名称错误?

[英]How to escape Python name error in for loop calling Shell script?

 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进行循环?

根据您的脚本

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

要调用外部外壳文件,请考虑子流程模块。 这个问题的更多内容

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM