Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProactorEventLoop is not supported #14

Open
Mennaruuk opened this issue Feb 7, 2022 · 1 comment
Open

ProactorEventLoop is not supported #14

Mennaruuk opened this issue Feb 7, 2022 · 1 comment

Comments

@Mennaruuk
Copy link

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

@hansalemaos
Copy link

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)`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants