Closed julyclyde closed 8 years ago
Try cleaning out the *.pyc files from the Sentry install path.
p.s. use ``` when putting in code so it doesnt lose text
still the same after deleted *.pyc from virtualenv path.
Something in your environment is wrong. I would:
There's nothing obvious to me in this error message, but it suggests a path error of some sorts, which would mean that your environment is not setup correctly (i.e. a sentry dependency is wrong)
the directory is not new. I've been using it for months. Last week, I upgrade my SSO plugin with pip install -U , it upgraded some distributions in the virtualenv path, and broken. I uninstalled raven, and install the former version 5.8.1 , it works.
As you teached, I deleted all *.pyc file from the virtualenv path, and install raven 5.9.2, it broke again.
-U can implicitly upgrade child dependencies if they're not locked in. To be clear, there's nothing broken with Sentry here, its something specific to your install so you're going to have to debug. If you do what I said (re-install the deps) things should be correct. You can also 'pip freeze' to see the versions of things, and while that error message doesnt provide enough context my first guess would be an invalid version of Django.
I deleted pip cache, and make a new virtualenv directory with distribution versions as above. With raven 5.8.1, works. Upgrade to 5.9.2, broken.
In sentry 7.7.0's requires.txt, it said: Django>=1.6.0,<1.7 In my virtualenv, Django version is 1.6.11 . My installation satisfies sentry's requirement. Have you try a new installation as you suggested?
@julyclyde we run the most recent versions of both sentry and raven-python on getsentry.com
Looking at this more carefully, you're running some python code which does not correctly setup a sentry environment. If this worked in the past it was a fluke, but it is not supported.
Fixed by call configure() from sentry.utils.runner first. Thank you.
But, I have another questions: Why does the way setup a sentry environment affect new version of SentryHandler's behavior?
It is because of the way Django's settings work. It causes recursive imports in Sentry. Our initialization forces things to happen in a way that avoids those problems.
Sorry for being not familiar with django nor logan. Can you give me some reading material about these problems?
# foo.py
import a
# a.py
import foo
I don't know exactly what Django does, if you want to learn more about it you'd be best off reading the source. Logan (no longer used in Sentry) simply allows the settings file to be specified as a path rather than a Python module.
I tried a.py and foo.py above, the file as command line script would run twice, once by command line, the other time by import. So, you mean django saved it's state in global, and re-execute broke the former-saved state?
I'm using Sentry 7.7.0 with default setting, Sentry Internal Handler as logging handler. When I upgrade raven from 5.8.1 to 5.9.2, I occur error.
my script is:
When python executing to the line of
it says: Traceback (most recent call last): File "", line 1, in
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/init.py", line 5, in
from django.db.models.query import Q
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/query.py", line 17, in
from django.db.models.deletion import Collector
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/deletion.py", line 4, in
from django.db.models import signals, sql
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/sql/init.py", line 4, in
from django.db.models.sql.subqueries import *
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/sql/subqueries.py", line 12, in
from django.db.models.sql.query import Query
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/sql/query.py", line 22, in
from django.db.models.sql import aggregates as base_aggregates_module
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/sql/aggregates.py", line 9, in
ordinal_aggregate_field = IntegerField()
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/db/models/fields/init.py", line 116, in init
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/conf/init.py", line 54, in getattr
self._setup(name)
File "/opt/VENV/sentry/lib/python2.7/site-packages/django/conf/init.py", line 50, in _setup
self._configure_logging()
File "/opt/VENV、sentry/lib/python2.7/site-packages/django/conf/init.py", line 80, in _configure_logging
logging_config_func(self.LOGGING)
File "/opt/rh/python27/root/usr/lib64/python2.7/logging/config.py", line 803, in dictConfig
dictConfigClass(config).configure()
File "/opt/rh/python27/root/usr/lib64/python2.7/logging/config.py", line 585, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler 'sentry': Cannot resolve 'raven.contrib.django.handlers.SentryHandler': cannot import name QuerySet
I downgrade raven to 5.9.1, got the same. I downgrade raven to 5.8.1, it works fine.
pip freeze as below: amqp==1.4.8 anyjson==0.3.3 BeautifulSoup==3.2.1 billiard==3.3.0.22 celery==3.1.19 cffi==1.4.2 contextlib2==0.4.0 cryptography==1.1.2 cssselect==0.9.1 cssutils==0.9.10 Django==1.6.11 django-bitfield==1.7.1 django-crispy-forms==1.4.0 django-jsonfield==0.9.13 django-paging==0.2.5 django-picklefield==0.3.2 django-recaptcha==1.0.4 django-social-auth==0.7.28 django-statsd-mozilla==0.3.14 django-sudo==1.1.3 django-templatetag-sugar==1.0 djangorestframework==2.3.14 email-reply-parser==0.2.0 enum34==0.9.23 exam==0.10.5 funcsigs==0.4 gevent==1.0.2 greenlet==0.4.9 gunicorn==19.4.1 hiredis==0.2.0 httplib2==0.9.2 idna==2.0 ipaddr==2.1.11 ipaddress==1.0.15 kombu==3.0.32 logan==0.7.1 lxml==3.5.0 Markdown==2.4.1 mock==1.3.0 ndg-httpsclient==0.4.0 nydus==0.11.0 oauth2==1.9.0.post1 pbr==1.8.1 pep8==1.6.2 petname==1.7 progressbar==2.3 py==1.4.31 pyasn1==0.1.9 pycparser==2.14 PyMySQL==0.6.6 pyOpenSSL==0.15.1 pytest==2.8.5 pytest-django==2.9.1 python-dateutil==2.4.2 python-memcached==1.57 python-openid==2.2.5 pytz==2015.7 PyYAML==3.11 raven==5.8.1 redis==2.10.5 requests==2.5.3 sentry==7.7.0 sentry-jira==0.9.0 sentry-sso-sankuai==0.3.4 setproctitle==1.1.9 simplejson==3.3.3 six==1.10.0 South==1.0.1 statsd==3.1 toronado==0.0.7 ua-parser==0.6.1 urllib3==1.7.1