Python多处理失败[Errno 32]pip损坏

2024-05-15 21:55:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我在服务器上运行python scraper。它需要收集大量的url,所以我想让它更快,并决定使用多处理。 问题是,抓取过程需要很长时间,所以我的睡眠连接最终会超时。因此我得到[Errno 32] Broken pipe错误。在

我能做些什么来保持脚本的运行吗?我可以跳过错误并让脚本继续吗?如果我抓到了,剧本还是停了,对吧?在

我有什么选择?或者我必须停止对服务器上运行的耗时脚本使用多处理?在

with Pool(5) as p:
    p.starmap(download_slick_slide_html, zip(sndLinkList, repeat(mode), repeat(pathToFF),repeat(pathToBinaries), repeat(dateTime), repeat(scrapedSupplier), repeat(logfile)))
    p.close()
    p.join()


def download_slick_slide_html(f_snd_link_list, f_mode, f_path_to_ff, f_path_to_binaries, f_date_time,f_scraped_supplier, f_log_file):
    # do some downloading here...

Tags: topath服务器脚本urlmode过程download