fermanjj / multiprocessing-and-multithreading-Python-example

An example in Python using multiprocessing and multithreading to process a list of work on a Queue
2 stars 0 forks source link

TypeError: can't pickle _thread.lock objects #1

Open NguyenDangBinh opened 2 years ago

NguyenDangBinh commented 2 years ago

dear all, I test main.py and I had the error like below: I can not fix it.

NUMB_PROCESSES = 12 Traceback (most recent call last): File ".\main.py", line 86, in start_processes() File ".\main.py", line 71, in start_processes p.start() File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\popen_spawn_win32.py", line 65, in init
reduction.dump(process_obj, to_child) File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) TypeError: can't pickle _thread.lock objects PS D:\multiprocessing\multiprocessing-and-multithreading-Python-example-master> Traceback (most recent call last): File "", line 1, in File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\spawn.py", line 99, in spawn_main new_handle = reduction.steal_handle(parent_pid, pipe_handle) File "C:\Users\DELL\AppData\Local\Programs\Python\Python36\lib\multiprocessing\reduction.py", line 82, in steal_handle _winapi.PROCESS_DUP_HANDLE, False, source_pid) OSError: [WinError 87] The parameter is incorrect

NguyenDangBinh commented 2 years ago

dear @fermanjj

fermanjj commented 2 years ago

@NguyenDangBinh I'm not quite sure what the error is here without some more context. Can you share some more code and how you're using it?