Asyncio error, An operation was attempted on something that is not a socket

后端 未结 1 470
心在旅途
心在旅途 2021-01-19 08:32

I\'m currently working on the current toy code to try and understand the asyncio module.

import asyncio
import os, sys, traceback
from time import time

os.e         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 09:02

    select() works only with sockets on Windows.

    To work with file descriptors, you could try non-select-based event loop, code example:

    if os.name == 'nt':
        loop = asyncio.ProactorEventLoop() # for subprocess' pipes on Windows
        asyncio.set_event_loop(loop)
    else:
        loop = asyncio.get_event_loop()
    

    Though I doubt that it would help with sys.stdin and asyncio, code example.

    0 讨论(0)
提交回复
热议问题