title: Getting "raised unexpected: BdbQuit()"
body: <p>Traceback:</p>
  
  <pre><code>[2014-09-16 17:27:04,912: ERROR/MainProcess] Task my_project.tasks.get_items[8481cd42-ec19-441f-b32d-03280570053c] raised unexpected: BdbQuit()
  Traceback (most recent call last):
    File "/vagrant/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
      R = retval = fun(*args, **kwargs)
    File "/vagrant/venv/local/lib/python2.7/site-packages/celery/app/trace.py", line 437, in __protected_call__
      return self.run(*args, **kwargs)
    File "/vagrant/my_project/my_app/tasks.py", line 21, in get_items
      logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
    File "/vagrant/my_project/my_app/tasks.py", line 21, in get_items
      logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
    File "/usr/lib/python2.7/bdb.py", line 49, in trace_dispatch
      return self.dispatch_line(frame)
    File "/usr/lib/python2.7/bdb.py", line 68, in dispatch_line
      if self.quitting: raise BdbQuit
  BdbQuit
  </code></pre>
  
  <p>I checked this <a href="https://stackoverflow.com/questions/4543967/">question</a> and tried using <em>celery.contrib.rdb</em> but after doing telnet I was sent to:</p>
  
  <pre><code>vagrant@vagrant-ubuntu-trusty-64:~$ telnet localhost 6900
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  --Call--
  &gt; /usr/lib/python2.7/contextlib.py(21)__exit__()
  -&gt; def __exit__(self, type, value, traceback):
  (Pdb) l
   16             try:
   17                 return self.gen.next()
   18             except StopIteration:
   19                 raise RuntimeError("generator didn't yield")
   20     
   21  -&gt;     def __exit__(self, type, value, traceback):
   22             if type is None:
   23                 try:
   24                     self.gen.next()
   25                 except StopIteration:
   26                     return
  (Pdb)
  </code></pre>
  
  <p>The code is:</p>
  
  <pre><code>from __future__ import absolute_import
  from celery import shared_task
  from . import utils
  from . import status
  import redis
  import pickle
  import logging
  from django.conf import settings
  import tweepy
  from celery.contrib import rdb
  
  logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s -%(filename)s:%(lineno)d - %(message)s')
  
  MAX_TWEETS_PER_PAGE = 200
  
  r = redis.StrictRedis(host='localhost', port=6379, db=0)
  
  @shared_task
  def get_items(user_id, external_page):
      rdb.set_trace()
      logging.debug('{} {}'.format(settings.API_KEY, settings.API_SECRET))
      logging.debug('{} {}'.format(settings.ACCESS_TOKEN, settings.ACCESS_TOKEN_SECRET))
  </code></pre>
  
  <p>The task ends successfully so far if I remove the set_trace call, but I need to be able to debug it because I'm going to add more things. Any help would be appreciated.</p>