I am trying to parallelize several command line calls in python, using PyCharm IDE. However I am getting some odd errors which I do not understand.
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
The create_command_list
returns a dataframe of strings which I want executed from the terminal. The expected output is that I am able to run all of these commands in parallel. However the errors I am getting refer back to the generate_command_list
function.
FileNotFoundError: [Errno 2] No such file or directory: 'excel_document.xlsx'
is an error returned which makes no sense to me. This excel document is used to create the list of executables but I do not see why it is part of the error here.
x may not pickle correctly or rely something not pickle correctly?
try:
x = [str(cmd) for cmd in create_command_list().values]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.