Celery logging handler fails to install with Python 2 #288

Closed
zsiciarz opened this Issue Apr 5, 2013 · 3 comments

Projects

None yet

3 participants

@zsiciarz
zsiciarz commented Apr 5, 2013

The recent Py3-related changes seem to break Celery error logging in Django. After I upgraded to raven==3.3.1, I get the following error on startup:

Failed installing logging handler for Celery
Traceback (most recent call last):
  File "/home/zbigniewsiciarz/v/gpanel/local/lib/python2.7/site-packages/raven/contrib/django/models.py", line 194, in register_handlers
    register_logger_signal(client)
  File "/home/zbigniewsiciarz/v/gpanel/local/lib/python2.7/site-packages/raven/contrib/celery/__init__.py", line 58, in register_logger_signal
    handler = SentryHandler(client)
  File "/home/zbigniewsiciarz/v/gpanel/local/lib/python2.7/site-packages/raven/handlers/logging.py", line 37, in __init__
    arg,
  File "/home/zbigniewsiciarz/v/gpanel/local/lib/python2.7/site-packages/raven/contrib/django/models.py", line 49, in <lambda>
    __repr__ = lambda x: repr(get_client())
  File "/home/zbigniewsiciarz/v/gpanel/local/lib/python2.7/site-packages/raven/contrib/django/models.py", line 141, in get_client
    instance = getattr(__import__(module, {}, {}, class_name), class_name)(**options)
TypeError: Item in ``from list'' not a string

My guess is that __import__ expects class_name to be str, not unicode (thanks to unicode_literals import). This happens with Python 2.7.3 on Ubuntu 12.04, Django 1.4.5. Downgrading raven to 3.2.1 fixes the problem.

@natethelen

I see this too. I have a clean install of Django 1.4.5 and raven 3.3.1 (I see the problem in 3.3.0, too) in Python 2.7.3

@xordoquy
Contributor
xordoquy commented Apr 5, 2013

Hi, this should have be fixed with the #287 (sorry, the PR title wasn't for that initially).

@xordoquy
Contributor
xordoquy commented Apr 5, 2013

Raven 3.3.2 fixes this issue.

@xordoquy xordoquy closed this Apr 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment