Import: not authorized `sentry_sdk' @ error/constitute.c/WriteImage/1028

I’m getting this error message when trying to import sentry_sdk. I was able to successfully install and upgraded sentry using this command and below mentioned is the result of the same.

root@evuser-ev:~# pip install --upgrade sentry-sdk==0.10.2
Requirement already up-to-date: sentry-sdk==0.10.2 in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: certifi in /usr/local/lib/python2.7/dist-packages (from sentry-sdk==0.10.2)
Requirement already up-to-date: urllib3 in /usr/local/lib/python2.7/dist-packages (from sentry-sdk==0.10.2)
You are using pip version 8.1.1, however version 19.2.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

I’m referring to the documentation https://sentry.io/onboarding/ev-pa/get-started/
Please help me fix the error message.

I have solved it by referring to “Capturing Messages” here https://docs.sentry.io/error-reporting/capturing/?platform=python

First I did this,

  1. python
  2. import sentry_sdk

  3. You can cause a Python error by inserting a divide by zero expression into your application: division_by_zero = 1 / 0
  4. sentry_sdk.init(“https://0881b420edb54a7d8996e0d87a180f3a@sentry.io/1512421”)

  5. from sentry_sdk import capture_message

  6. capture_message(‘Something went wrong’)

[Once it is capture message is clicked you should see something like this [‘75c0a095aeea4e7dbe4520e9abee3240’].]

and it triggered a notification in my login on sentry.

Here is a link which worked when I installed the same on Lenovo laptop thinkpad with Ubuntu version 16 for Self-Hosted Sentry. [https://www.howtoforge.com/how-to-install-sentry-with-docker-on-ubuntu-1804/]