requests-threads icon indicating copy to clipboard operation
requests-threads copied to clipboard

ProactorEventLoop is not supported

Open Mennaruuk opened this issue 3 years ago • 1 comments

I get this error:

Traceback (most recent call last):
  File "C:\Users\Menna\Desktop\requests-futures\twayback.py", line 3, in <module>
    session = AsyncSession(n=100)
  File "C:\Users\Menna\AppData\Local\Programs\Python\Python310\lib\site-packages\requests_threads.py", line 37, in __init__
    asyncioreactor.install(loop)
  File "C:\Users\Menna\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\asyncioreactor.py", line 308, in install
    reactor = AsyncioSelectorReactor(eventloop)
  File "C:\Users\Menna\AppData\Local\Programs\Python\Python310\lib\site-packages\twisted\internet\asyncioreactor.py", line 63, in __init__
    raise TypeError(
TypeError: ProactorEventLoop is not supported, got: <ProactorEventLoop running=False closed=False debug=False>

upon running the following Python script: https://pastebin.com/raw/xrujJmSu

Use the following example command if you'd like to run the script: script.py -u jack -from 20220205 -to 20220206

Mennaruuk avatar Feb 07 '22 09:02 Mennaruuk

I have had the same problem. This here seems to work:

`import asyncio, sys

if sys.platform == 'win32': loop = asyncio.SelectorEventLoop() asyncio.set_event_loop(loop)

from twisted.internet.defer import inlineCallbacks from twisted.internet.task import react from requests_threads import AsyncSession session = AsyncSession(n=100)

@inlineCallbacks def main(reactor): responses = [] for i in range(100): responses.append(session.get('http://httpbin.org/get'))

for response in responses:
    r = yield response
    print(r)

if name == 'main': react(main)`

hansalemaos avatar Sep 05 '22 23:09 hansalemaos