Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

fix event loop is closed in win10 #69

Merged
merged 3 commits into from
Jan 16, 2021
Merged

fix event loop is closed in win10 #69

merged 3 commits into from
Jan 16, 2021

Conversation

ccinv
Copy link
Collaborator

@ccinv ccinv commented Jan 15, 2021

要增加/修改的功能/修复的bug

win10运行错误

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000208F47B9B80>
 Traceback (most recent call last):
   File "C:\Users\avaic\miniconda3\envs\exe\lib\asyncio\proactor_events.py", line 116, in __del__
     self.close()
   File "C:\Users\avaic\miniconda3\envs\exe\lib\asyncio\proactor_events.py", line 108, in close
     self._loop.call_soon(self._call_connection_lost, None)
   File "C:\Users\avaic\miniconda3\envs\exe\lib\asyncio\base_events.py", line 746, in call_soon
     self._check_closed()
   File "C:\Users\avaic\miniconda3\envs\exe\lib\asyncio\base_events.py", line 510, in _check_closed
     raise RuntimeError('Event loop is closed')
 RuntimeError: Event loop is closed

解决一个结束时会发生的运行错误

相关issue

改动内容描述

核验信息

核验以下信息,已完成的项记得补全check box(中括号里填'x'):

  • 是否测试过功能正确性;
  • 是否修改CHANGELOG,增加变动描述;
  • 确认是否需要修改README;
  • 新增代码是否有相应注释(或者代码是否清晰到足以不写注释);

新代码效果截屏(建议)

@puppylpg
Copy link
Owner

我用win10跑的时候,没有什么问题呀?是每次跑都有问题吗

@ccinv
Copy link
Collaborator Author

ccinv commented Jan 15, 2021

恩 删掉cache跑了两次 重复出现了问题

@puppylpg
Copy link
Owner

哦,只有删cache的时候才会有问题吗?现在的代码我之前试的时候是用不用cache都没啥问题

(顺便写一下readme吧,好发版本)

@ccinv
Copy link
Collaborator Author

ccinv commented Jan 15, 2021

第一次跑 或者删cache 也就是只要跑过steam历史都会有 但其实是个小问题 因为他是爬完全部数据并且退出的时候才报错的

@puppylpg
Copy link
Owner

ok,代码我没啥问题,加个changelog就可以合了发新版本了 👍

@@ -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())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接取消这行注释不就可以了吗?我之前做这个的时候这里是没注释的, @puppylpg 注释掉的吧
然后现在新版本不推荐使用run_until_complete了,我之前测试的时候先set_event_loop_policy再run没报错,建议没有特殊问题的话还是还是用asyncio.run

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前注释掉是因为去掉跑着并没有什么问题,我就把windows specific code删了 😢

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

问题不大,能用就行
我也是测试没发现问题,完全没注意到这里改了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aio-libs/aiohttp#4324 (comment)
应该是Win下面aiohttp的一个Bug,他说3.7已经解决了,然而我这也是3.7,错误情况和他3.6的一模一样,而且同样的workaround可以绕过去..

@ccinv ccinv merged commit 4eec549 into master Jan 16, 2021
@ccinv ccinv deleted the winfix branch January 16, 2021 05:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants