Geographic Information Systems Asked on November 16, 2021
I am creating a plugin which interacts with a third-party API (through the package ArlulaApi). At some point in my package tree (for the plugin), gevent
is imported, meaning that a monkey patch is required for the Python SSL
package to work correctly (otherwise, RecursionError
is thrown – see here). Currently, I am trying this at the very top of my plugin code:
import gevent.monkey
gevent.monkey.patch_socket()
gevent.monkey.patch_ssl()
However, this throws a warning:
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
(C:OSGEO4~1appsPython37libsite-packagesurllib3utilinit.py)’,
‘urllib3.util.ssl_
(C:OSGEO4~1appsPython37libsite-packagesurllib3utilssl_.py)’].
It appears that SSL is imported when QGIS boots up, before my plugin is loaded, and so the monkey patching does not have the desired effect.
What are my options here?
Am I missing something really obvious?
Are there ways to monkey patch earlier, or do I have to create a plugin that does not require monkey patching?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP