def CaptureThread(num,path): try: tables_list.clear() count = 0 getTables() CaptureImageUrl('capture_url') gap = math.ceil(len(captureurl_list) / int(num)) for i in range(int(num)): cap_url = captureurl_list[count:count+gap] cap_id = captureid_list[count:count+gap] cap_deviceid = capturedeviceid_list[count:count+gap] cap_table_name = capturetables_list[count:count+gap] t = threading.Thread(target=Capture_ImageDownload,args=(path,cap_url,cap_id,cap_deviceid,cap_table_name)) threads_list.append(t) count += gap for t in threads_list: t.setDaemon(True) time.sleep(0.5) t.start() for t in threads_list: t.join() except Exception as e: print(e) input("Press <enter>..........") ``` ``` def SceneThread(num,path): try: tables_list.clear() count = 0 getTables() SceneImageUrl('scene_url') gap = math.ceil(len(sceneurl_list) / int(num)) for i in range(int(num)): sce_url = sceneurl_list[count:count + gap] sce_id = sceneid_list[count:count + gap] sce_deviceid = scenedeviceid_list[count:count + gap] sce_table_name = scenetables_list[count:count + gap] t = threading.Thread(target=Scene_ImageDownload,args=(path, sce_url, sce_id, sce_deviceid, sce_table_name)) threads_list.append(t) count += gap for t in threads_list: t.setDaemon(True) time.sleep(0.5) t.start() for t in threads_list: t.join() except Exception as e: print(e) input("Press <enter>..........") ``` 通过两个进程分别调用上面两个函数,运行一会的时候就会停了,单独调用上面函数的时候正常 ``` try: p = multiprocessing.Process(target=CaptureThread, args=(t_num, CaptureImg_path,)) p1 = multiprocessing.Process(target=SceneThread,args=(t_num, SceneImg_path,)) p.daemon=True p1.daemon=True p.start() p1.start() p.join() p1.join() except Exception as e: print(e) input("Press <enter>..........") ```
可以看看抛出什么异常了
没任何异常
看看内存使用量 是不是资源不够