Use a function object:
class Copier(object):
def __init__(self, tgtdir):
self.target_dir = tgtdir
def __call__(self, src):
copy_file(src, self.target_dir)
To run your Pool.map
:
p.map(Copier(target_dir), file_list)
More Related Contents:
- Can’t pickle when using multiprocessing Pool.map()
- Keyboard Interrupts with python’s multiprocessing Pool
- Python Process Pool non-daemonic?
- Combine Pool.map with shared memory Array in Python multiprocessing
- Filling a queue and managing multiprocessing in python
- Multiprocessing.Pool makes Numpy matrix multiplication slower
- Can I use a multiprocessing Queue in a function called by Pool.imap?
- multiprocessing.Pool() slower than just using ordinary functions
- How do you pass a Queue reference to a function managed by pool.map_async()?
- Passing multiple parameters to pool.map() function in Python [duplicate]
- Python Multiprocess Pool. How to exit the script when one of the worker process determines no more work needs to be done?
- Python: Writing to a single file with queue while using multiprocessing Pool
- Python multiprocessing – tracking the process of pool.map operation
- How to use Python multiprocessing Pool.map to fill numpy array in a for loop
- How to run functions in parallel?
- multiprocessing.Pool: When to use apply, apply_async or map?
- Dead simple example of using Multiprocessing Queue, Pool and Locking
- multiprocessing.Pool: What’s the difference between map_async and imap?
- Python Multiprocessing: Handling Child Errors in Parent
- Log output of multiprocessing.Process
- pandas multiprocessing apply
- Why does Python’s multiprocessing module import __main__ when starting a new process on Windows?
- Appending to the same list from different processes using multiprocessing
- Exception thrown in multiprocessing Pool not detected
- Using the multiprocessing module for cluster computing
- What is the difference between multiprocessing and subprocess?
- Python Multiprocessing Lib Error (AttributeError: __exit__)
- Show the progress of a Python multiprocessing pool imap_unordered call?
- Easiest way to read csv files with multiprocessing in Pandas
- Why multiprocessing.Process behave differently on windows and linux for global object and function arguments