[英]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.