[英]Errors running commands in parallel with python multiprocessing
我正在嘗試使用PyCharm IDE並行化python中的幾個命令行調用。 但是我遇到了一些我不理解的奇怪錯誤。
from generate_command_list import create_list
import multiprocessing
import subprocess
x = create_command_list().values
def execute_commandline_call(executable):
subprocess.call(executable, shell=True)
if __name__ == '__main__':
for i in x:
p = multiprocessing.Process(target=execute_commandline_call,args=(i,))
p.start()
#p.join() # not needed as each run is independent of each other
create_command_list
返回要從終端執行的字符串數據幀。 預期的輸出是我能夠並行運行所有這些命令。 但是我得到的錯誤又回到了generate_command_list
函數。
FileNotFoundError:[錯誤2]沒有這樣的文件或目錄:'excel_document.xlsx'
返回的錯誤對我來說毫無意義。 此excel文檔用於創建可執行文件列表,但在這里我看不到它為什么是錯誤的一部分。
x可能無法正確腌制或依靠某些不正確腌制的東西?
嘗試:
x = [str(cmd) for cmd in create_command_list().values]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.