Perhaps this is a known issue?
Python 2.7.16 on raspberry pi exceptions are not sent to sentry.io
capture_message works fine but division_by_zero exception is not sent.
This exception seems to be raised when closing the python shell with sentry-sdk initialised:
Exception in thread raven-sentry.BackgroundWorker (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/local/lib/python2.7/dist-packages/sentry_sdk/integrations/threading.py", line 52, in run
File "/usr/local/lib/python2.7/dist-packages/sentry_sdk/hub.py", line 233, in __exit__
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'set'
I should say it works fine in the Pycharm 2.7.16 venv on Windows 10
Here’s the test I did:
import sentry_sdk
from sentry_sdk import capture_message, configure_scope, last_event_id
sentry_sdk.init(
dsn="https://api_key_goes_here@sentry.io/1111111"
)
with configure_scope() as scope:
scope.level = 'info'
scope.set_tag("environment", "random-sentry-test")
capture_message('message captured')
print('last event id: %s' % last_event_id())
division_by_zero = 1 / 0
I think this is the same issue as https://github.com/getsentry/sentry-python/issues/334. Do you see this issue with Python 3 on raspberry pi?
I’ll set up a venv with python 3 in a bit and see.
However, I’ve noticed that if I’m using the python shell on the pi, it doesn’t submit to sentry.
Exactly the same code works fine if I paste it into sentry_test.py and execute as python sentry_test.py
The exception above occurs regardless of success sending to sentry - & yes - it happens when the shell is terminated or the script finishes.
We don’t report uncaught exceptions in REPLs because that would send every typo to Sentry.