hootnot / oandapyV20-examples

Examples demonstrating the use of oandapyV20 (oanda-api-v20)
MIT License
147 stars 65 forks source link

concurrent_stream.py gives max recursion error #28

Closed horsehead97 closed 1 year ago

horsehead97 commented 2 years ago

python concurrent_stream.py --instrument 'EUR_USD,EUR_AUD' C:\Users\horse\Documents\myprojects\oandapyV20-examples\src\concurrentstream.py:36: 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): ['urllib3.util.ssl (C:\Users\horse\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl_.py)', 'urllib3.util (C:\Users\horse\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\init.py)']. monkey.patch_all() The Log says: 2022-04-01 13:25:26,926 [DEBUG] urllib3.connectionpool : Starting new HTTPS connection (1): api-fxpractice.oanda.com:443 2022-04-01 13:25:26,949 [DEBUG] urllib3.connectionpool : Starting new HTTPS connection (1): stream-fxpractice.oanda.com:443 2022-04-01 13:25:27,090 [ERROR] main : Generic exception <class 'RecursionError'> concurrent_stream.py 232 2022-04-01 13:25:27,091 [ERROR] main : Some exception: maximum recursion depth exceeded while calling a Python object 0

horsehead97 commented 2 years ago

I put the line "monkey.patch_all()" right after "gevent import monkey" and before the rest of the imports. One of those proceding imports must be importing ssl? It seems to work fine now.