Open ben opened 8 years ago
It turns out this is only an issue with eventlet
installed. Importing raven
causes all of the transports to get imported, including https://github.com/getsentry/raven-python/blob/356a7c4d83a5289e7b30a07b0f76829e274b7481/raven/transport/eventlet.py#L14
which eventually imports https://github.com/eventlet/eventlet/blob/49773bb12b84e10ccb0a199c301f97fd6528ab68/eventlet/green/httplib.py#L16
which causes the check here to fail https://github.com/jcgregorio/httplib2/blob/cf631a73e2f3f43897b65206127ced82382d35f5/python3/httplib2/__init__.py#L1366
because httplib2 imported http.client
before it was replaced by an identical version by eventlet. The simple fix is to import raven
before importing httplib2
/twilio
.
Eventlet bug report: https://github.com/eventlet/eventlet/issues/316
FYI this is fixed in Eventlet master branch and should be released fairly soon.
Found this because of a strange exception when integrating with Celery and making HTTP requests, but there's a simpler reproduction scenario. Here's my example program:
And here's the output:
The very act of importing
raven.Client
causes httplib2 to stop working. In my case, it surfaced as a mysterious error deep inside the Twilio client, which I'll paste below in case someone else googles for it.This is using Python 3.4.3, raven==5.9.0, and httplib2==0.9.2, all of which appear to be the latest.
That Twilio library exception: