From 11be398c3716fae944965d21eb36bee5649fa1bb Mon Sep 17 00:00:00 2001 From: ccinv Date: Fri, 15 Jan 2021 13:48:51 +0800 Subject: [PATCH 1/3] fix event loop is closed in win10 --- src/__main__.py | 4 ++++ src/crawl/item_crawler.py | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/__main__.py b/src/__main__.py index b2068ce..29a028e 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -1,3 +1,4 @@ +import sys import datetime from src.crawl import item_crawler @@ -6,6 +7,9 @@ if __name__ == '__main__': + if sys.version_info[:2] == (3, 7): + asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) + # start start = datetime.datetime.now() log.info("Start Time: {}".format(start)) diff --git a/src/crawl/item_crawler.py b/src/crawl/item_crawler.py index 44294ab..f624efa 100644 --- a/src/crawl/item_crawler.py +++ b/src/crawl/item_crawler.py @@ -1,6 +1,6 @@ import re -import asyncio import math +import asyncio # from tqdm import tqdm @@ -59,8 +59,7 @@ def csgo_all_categories(): def enrich_item_with_price_history(csgo_items, crawl_steam_async=True): # crawl price for all items if crawl_steam_async: - # asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) - asyncio.run(history_price_crawler.async_crawl_history_price(csgo_items)) + asyncio.get_event_loop().run_until_complete(history_price_crawler.async_crawl_history_price(csgo_items)) else: history_price_crawler.crawl_history_price(csgo_items) return csgo_items From 3cea0a198a7902050340ce920c46cd3cf8b5b635 Mon Sep 17 00:00:00 2001 From: ccinv Date: Sat, 16 Jan 2021 13:33:38 +0800 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf063e4..efdd4d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -140,3 +140,7 @@ ## 4.1.0(2021-01-11) * 功能 - aio http session使用自定义timeout,可以和cache兼容使用(默认的timeout为什么不行,原因不明……); + +## 4.1.1(2021-01-11) +* bugfix + - 修复(workaround)win下结束爬取后报错的问题 From 1141ea421cd58568e664300c255f332d0a03baa1 Mon Sep 17 00:00:00 2001 From: ccinv Date: Sat, 16 Jan 2021 13:37:50 +0800 Subject: [PATCH 3/3] 1-16 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efdd4d7..a22b63b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -141,6 +141,6 @@ * 功能 - aio http session使用自定义timeout,可以和cache兼容使用(默认的timeout为什么不行,原因不明……); -## 4.1.1(2021-01-11) +## 4.1.1(2021-01-16) * bugfix - 修复(workaround)win下结束爬取后报错的问题