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

Grequests warning and crash #163

Closed
BIGdeadLock opened this issue Mar 20, 2023 · 3 comments
Closed

Grequests warning and crash #163

BIGdeadLock opened this issue Mar 20, 2023 · 3 comments
Labels
🙉🙈🙊 gevent some issue likely caused by gevent, not necessarily grequests

Comments

@BIGdeadLock
Copy link

BIGdeadLock commented Mar 20, 2023

I'm using map to send multiple get requests. This is the code:

responses = grequests.map(
[grequests.get(url, timeout=self._timeout) for url in url_pool],
size=self._max_requests)

When I start my flask server (before the line execute)
I get the following warning when using grequests:
image

If I ignore the error and run the code it crashes:
image

I've import grequests before the requests library.

Environment:

  • Python 3.8
  • Windows
@BIGdeadLock
Copy link
Author

I managed to reslove the Monkey patch error by adding:
from gevent import monkey as mon
mon.patch_all(thread=False, select=False)

in the main.py (not the same place where the grequests was import).

Now grequests work but I get the following warning when I start my program:

image

@spyoungtech spyoungtech added the 🙉🙈🙊 gevent some issue likely caused by gevent, not necessarily grequests label Mar 21, 2023
@spyoungtech
Copy link
Owner

You need to make sure gevent is imported first. Also, you need to use a gevent-compatible debugger.

I'm guessing this is the same fundamental issue in your other issue so, I am going to close this one in favor of using #164 for further discussion.

@BIGdeadLock
Copy link
Author

Is it supposed to be imported before grequests? Anyhow, it is imported first. It's the first module to be imported in the project and I still get the warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙉🙈🙊 gevent some issue likely caused by gevent, not necessarily grequests
Projects
None yet
Development

No branches or pull requests

2 participants