作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在使用 ipdb 调试器在本地调试多线程 Web 应用程序(Django、Plone)。通常 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 缓解这个问题并使其在多线程/自动重载方面更加安全?
编辑:稍微澄清了这个问题,因为我认为这可能是潜在的 IPython 问题。可能有某种解决方法,使 IPython 在重新加载时简单地丢弃历史记录或禁用有问题的 IPython SQLite 以其他方式写入。
最佳答案
你总是可以在单线程模式下运行 Django
python manage.py runserver --nothreading
关于python - ipdb,多线程和自动重新加载程序导致 ProgrammingError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16580234/
我是一名优秀的程序员,十分优秀!