2013-05-16 7 views
5

私はマルチスレッドWebアプリケーションをローカルでデバッグするためにipdbデバッガを使用しています(Django、Plone)。しばしばipdbは、私がデバッグプロンプトを表示しているときに起こる自動ロードのために混乱するようです。その結果、スタックトレースは、この後ProgrammingErrorを引き起こすipdb、複数のスレッドと自動ロードプログラム

/Users/mikko/code/xxxx/venv/lib/python2.7/site-packages/IPython/core/history.pyc in writeout_cache(self, conn) 
     605   with self.db_input_cache_lock: 
     606    try: 
    --> 607     self._writeout_input_cache(conn) 
     608    except sqlite3.IntegrityError: 
     609     self.new_session(conn) 

    /Users/mikko/code/xxxx/venv/lib/python2.7/site-packages/IPython/core/history.pyc in _writeout_input_cache(self, conn) 
     589    for line in self.db_input_cache: 
     590     conn.execute("INSERT INTO history VALUES (?, ?, ?, ?)", 
    --> 591         (self.session_number,)+line) 
     592 
     593  def _writeout_output_cache(self, conn): 

    ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 4546363392 and this is thread id 140735211872640 

まで来て、いずれかのプログラムは、(スレッドをぶら下げ)閉じることができないか、自身ipdb作業を停止します。

この問題をipdbで移行し、さらにマルチスレッド/自動ロードを安全にする方法はありますか?

EDIT:これはIPythonの問題の根底にあると思われるため、少し質問を明確にしました。 IPythonをリロード時の履歴を破棄するか、または問題のあるIPythonを無効にすることで、何らかの回避策が生じる可能性があります。

答えて

5

あなたは常にシングルスレッドモードではDjangoを実行することができます

python manage.py runserver --nothreading 
関連する問題