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

MonkeyPatchWarning #81

Closed
EmilyRagan opened this issue Dec 26, 2018 · 3 comments
Closed

MonkeyPatchWarning #81

EmilyRagan opened this issue Dec 26, 2018 · 3 comments

Comments

@EmilyRagan
Copy link

When importing from wampy (tried from wampy.peers import Client and import wampy) both when trying to run a file and when in the Python REPL, I get the following error (I broke it into several lines to make it a bit more readable):

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wampy/__init__.py:28: 
MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, 
including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. 
Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. 
Modules that had direct imports (NOT patched):
['eventlet.green.ssl (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/eventlet/green/ssl.py)']. 
Subclasses (NOT patched): ["<class 'eventlet.green.ssl.GreenSSLContext'>"].
  gevent.monkey.patch_all()

Python v3.7.1

@noisyboiler
Copy link
Owner

Hi @EmilyRagan
thanks for raising this. yep, I see the problem. will address it in the next release.
Simon

@noisyboiler
Copy link
Owner

noisyboiler commented Dec 31, 2018

i think this makes sense if you have imported wampy after importing a bunch of stuff yourself in a script. i believe that once it's done the first time, following calls are a no-op. It's worth trying doing the monkey patch at the very top of your script (or commands) and seeing if the error disappears when subsequently importing wampy?
i.e.

import gevent.monkey
gevent.monkey.patch_all()

This returns True on the first call, then nothing thereafter.

If this fixes your error messages then it's time for me to update the README with some guidelines on how to use wampy in a script.

Look forward to hearing back from you.

Thanks for your interest.

Simon

@noisyboiler
Copy link
Owner

hiya @EmilyRagan
wampy can't do the monkey business any earlier, so i am confident that the above advice to you is correct. re-open this if you have more ways to recreate this issue, or email me directly if you like.
Once again, thanks for your interest! I'm really pleased that you're using wampy.
Simon

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