gpt4 book ai didi

python - ipdb,多线程和自动重新加载程序导致 ProgrammingError

转载 作者:IT王子 更新时间:2023-10-29 06:26:04 33 4
gpt4 key购买 nike

我正在使用 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/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com