Ipython: 提供如何处理异常消息中的“sqlite3.OperationalError:尝试写入只读数据库”的信息

创建于 2014-01-01  ·  4评论  ·  资料来源: ipython/ipython

我遇到了 sqlite3.OperationalError:尝试编写只读数据库
(附加堆栈跟踪)。 由于这似乎是与数据库连接相关的错误,因此错误消息可能更准确(这是我的增强请求),指定失败的连接参数(至少是主机和端口)。 目前尚不清楚该计划的预期可能是什么。

堆栈跟踪

sys.excepthook 中的错误:
回溯(最近一次调用最后一次):
文件“/mnt/DATA/sources/ipython/IPython/core/application.py”,第 175 行,在excepthook
返回 self.crash_handler(etype, evalue, tb)
文件“/mnt/DATA/sources/ipython/IPython/core/crashhandler.py”,第 158 行,调用中
traceback = TBhandler.text(etype,evalue,etb,context=31)
文件“/mnt/DATA/sources/ipython/IPython/core/ultratb.py”,第 412 行,文本
tb_offset,上下文)
文件“/mnt/DATA/sources/ipython/IPython/core/ultratb.py”,第 963 行,在structured_traceback
ipinst = ipapi.get()
文件“/mnt/DATA/sources/ipython/IPython/core/ipapi.py”,第 28 行,在 get
返回 InteractiveShell.instance()
文件“/mnt/DATA/sources/ipython/IPython/config/configurable.py”,第318行,例如
inst = cls(_args, _kwargs)文件“/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py”,第 436 行,在init 中self.init_history()文件“/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py”,第 1489 行,在 init_historyself.history_manager = HistoryManager(shell=self, config=self.config)文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第 409 行,在init 中self.new_session()文件 ”",第 2 行,在 new_session 中文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第60行,在needs_sqlite返回 f(_a,_ 千瓦)
文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第 427 行,在 new_session 中
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError:尝试写入只读数据库

原来的例外是:
回溯(最近一次调用最后一次):
文件“/usr/bin/ipython”,第 7 行,在
launch_new_instance()
文件“/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py”,第388行,在launch_new_instance
应用程序初始化()
文件 ”",第 2 行,在初始化中
文件“/mnt/DATA/sources/ipython/IPython/config/application.py”,第 84 行,在 catch_config_error
返回方法(应用程序,_args, _kwargs)文件“/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py”,第324行,初始化self.init_shell()文件“/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py”,第 340 行,在 init_shell 中ipython_dir=self.ipython_dir)文件“/mnt/DATA/sources/ipython/IPython/config/configurable.py”,第318行,例如inst = cls(_args, *_kwargs)文件“/mnt/DATA/sources/ipython/IPython/frontend/terminal/interactiveshell.py”,第 360 行,在init 中user_module=user_module,custom_exceptions=custom_exceptions文件“/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py”,第 436 行,在init 中self.init_history()文件“/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py”,第 1489 行,在 init_historyself.history_manager = HistoryManager(shell=self, config=self.config)文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第 409 行,在init 中self.new_session()文件 ”",第 2 行,在 new_session 中文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第60行,在needs_sqlite返回 f(_a,_ 千瓦)
文件“/mnt/DATA/sources/ipython/IPython/core/history.py”,第 427 行,在 new_session 中
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError:尝试写入只读数据库

python -c "import IPython; print(IPython.sys_info())" 的输出:

{'commit_hash':'858d539',
'commit_source': '安装',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
'ipython_version': '0.13.2',
'os_name': 'posix',
'平台':'Linux-3.11.0-14-generic-x86_64-with-Ubuntu-13.10-saucy',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version':'2.7.5+(默认,2013 年 9 月 19 日,13:48:49)n[GCC 4.8.1]'}

如果能够将文件附加到问题报告并能够搜索已经提交的问题 (!!),那就太好了。

最有用的评论

我试过了,它奏效了。 谢谢@takluyver ,@richtekp。

~/.ipython/profile_default/history.sqlite
/Users/ChessTastic/.ipython/profile_default/history.sqlite.
➜  profile_default  sudo chmod a+w history.sqlite
Password:

所有4条评论

sqlite 使用文件,而不是数据库服务器。 默认情况下,它将保存在~/.ipython/profile_default/history.sqlite 。 该文件是否存在,是否可写?

谢谢你的提示! 该文件具有错误的权限(不可写)。 我建议改进错误消息/输出。

有可能将文件附加到问题报告中会很好

使用gists很常见。

并且能够搜索已经提交的问题 (!!)。

搜索字段位于页面顶部。

我试过了,它奏效了。 谢谢@takluyver ,@richtekp。

~/.ipython/profile_default/history.sqlite
/Users/ChessTastic/.ipython/profile_default/history.sqlite.
➜  profile_default  sudo chmod a+w history.sqlite
Password:
此页面是否有帮助?
0 / 5 - 0 等级

相关问题

ngoldbaum picture ngoldbaum  ·  45评论

albireox picture albireox  ·  33评论

ivanov picture ivanov  ·  38评论

BLeila picture BLeila  ·  34评论

ellisonbg picture ellisonbg  ·  49评论