Python: pool.map_async with multiple parameters

42 views Asked by At

I need some help with python pool.

def read_values(entry, second):
 ....

async_output = pool.map_async(partial(read_values, second='second'), string_array)
output_array = async_output.get()

The above code is working. I really want the below:

logfile = open("./async.log", "a+", 1)

def read_values(entry, second):
 ....

async_output = pool.map_async(partial(read_values, second=logfile), string_array)
output_array = async_output.get()

This is not working!

Is it possible to pass an open file reference to a pool?

0

There are 0 answers