我遇到了 sqlite3.OperationalError:尝试编写只读数据库
(附加堆栈跟踪)。 由于这似乎是与数据库连接相关的错误,因此错误消息可能更准确(这是我的增强请求),指定失败的连接参数(至少是主机和端口)。 目前尚不清楚该计划的预期可能是什么。
堆栈跟踪
原来的例外是:
回溯(最近一次调用最后一次):
文件“/usr/bin/ipython”,第 7 行,在
launch_new_instance()
文件“/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py”,第388行,在launch_new_instance
应用程序初始化()
文件 ”
文件“/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()文件 ”
文件“/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())" 的输出:
如果能够将文件附加到问题报告并能够搜索已经提交的问题 (!!),那就太好了。
sqlite 使用文件,而不是数据库服务器。 默认情况下,它将保存在~/.ipython/profile_default/history.sqlite
。 该文件是否存在,是否可写?
谢谢你的提示! 该文件具有错误的权限(不可写)。 我建议改进错误消息/输出。
我试过了,它奏效了。 谢谢@takluyver ,@richtekp。
~/.ipython/profile_default/history.sqlite
/Users/ChessTastic/.ipython/profile_default/history.sqlite.
➜ profile_default sudo chmod a+w history.sqlite
Password:
最有用的评论
我试过了,它奏效了。 谢谢@takluyver ,@richtekp。