Ipython: ์˜ˆ์™ธ ๋ฉ”์‹œ์ง€์—์„œ "sqlite3.OperationalError: ์ฝ๊ธฐ ์ „์šฉ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์“ฐ๊ธฐ ์‹œ๋„"๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ์ •๋ณด ์ œ๊ณต

์— ๋งŒ๋“  2014๋…„ 01์›” 01์ผ  ยท  4์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: ipython/ipython

sqlite3.OperationalError๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค: ์ฝ๊ธฐ ์ „์šฉ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ž‘์„ฑํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
(์Šคํƒ ์ถ”์  ์ฒจ๋ถ€). ์ด๊ฒƒ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์—ฐ๊ฒฐ๊ณผ ๊ด€๋ จ๋œ ์˜ค๋ฅ˜์ธ ๊ฒƒ ๊ฐ™์œผ๋ฏ€๋กœ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ๋” ์ •ํ™•ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(๋‚ด ๊ฐœ์„  ์š”์ฒญ). ์‹คํŒจํ•œ ์—ฐ๊ฒฐ ๋งค๊ฐœ๋ณ€์ˆ˜(์ตœ์†Œํ•œ ํ˜ธ์ŠคํŠธ ๋ฐ ํฌํŠธ)๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋žจ์—์„œ ์˜ˆ์ƒํ•œ ๋‚ด์šฉ์ด ๋ฌด์—‡์ธ์ง€๋Š” ๋ถ„๋ช…ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์Šคํƒ ์ถ”์ 

sys.excepthook์˜ ์˜ค๋ฅ˜:
์—ญ์ถ”์ (๊ฐ€์žฅ ์ตœ๊ทผ ํ˜ธ์ถœ ๋งˆ์ง€๋ง‰):
"/mnt/DATA/sources/ipython/IPython/core/application.py" ํŒŒ์ผ, 175ํ–‰, ์˜ˆ์™ธ ํ›„ํฌ
self.crash_handler ๋ฐ˜ํ™˜(etype, evalue, tb)
ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/crashhandler.py", 158ํ–‰, ํ˜ธ์ถœ ์ค‘
์—ญ์ถ”์  = TBhandler.text(etype,evalue,etb,context=31)
ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/ultratb.py", 412ํ–‰, ํ…์ŠคํŠธ
tb_offset, ์ปจํ…์ŠคํŠธ)
Structured_traceback์˜ ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/ultratb.py", 963ํ–‰
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ํ–‰, ์ดˆ๊ธฐํ™”self.init_history()ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", init_history์˜ 1489ํ–‰self.history_manager = HistoryManager(shell=self, config=self.config)ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 409ํ–‰, ์ดˆ๊ธฐํ™”self.new_session()ํŒŒ์ผ "", 2ํ–‰, new_sessionํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 60ํ–‰, needs_sqlite์—์„œ๋ฐ˜ํ™˜ f(_a,_ ํฌ)
new_session์—์„œ ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 427ํ–‰
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError: ์ฝ๊ธฐ ์ „์šฉ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์“ฐ๊ธฐ ์‹œ๋„

์›๋ž˜ ์˜ˆ์™ธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์—ญ์ถ”์ (๊ฐ€์žฅ ์ตœ๊ทผ ํ˜ธ์ถœ ๋งˆ์ง€๋ง‰):
ํŒŒ์ผ "/usr/bin/ipython", 7ํ–‰,
launch_new_instance()
launch_new_instance์˜ ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/frontend/terminal/ipapp.py", 388ํ–‰
์•ฑ ์ดˆ๊ธฐํ™”()
ํŒŒ์ผ "", 2ํ–‰, ์ดˆ๊ธฐํ™” ์ค‘
catch_config_error์˜ ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/config/application.py", 84ํ–‰
๋ฐ˜ํ™˜ ๋ฐฉ๋ฒ•(์•ฑ, _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_shellipython_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ํ–‰, ์ดˆ๊ธฐํ™”user_module=user_module, custom_exceptions=custom_exceptionsํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", 436ํ–‰, ์ดˆ๊ธฐํ™”self.init_history()ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/interactiveshell.py", init_history์˜ 1489ํ–‰self.history_manager = HistoryManager(shell=self, config=self.config)ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 409ํ–‰, ์ดˆ๊ธฐํ™”self.new_session()ํŒŒ์ผ "", 2ํ–‰, new_sessionํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 60ํ–‰, needs_sqlite์—์„œ๋ฐ˜ํ™˜ f(_a,_ ํฌ)
new_session์—์„œ ํŒŒ์ผ "/mnt/DATA/sources/ipython/IPython/core/history.py", 427ํ–‰
NULL, "") """, (datetime.datetime.now(),))
sqlite3.OperationalError: ์ฝ๊ธฐ ์ „์šฉ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์“ฐ๊ธฐ ์‹œ๋„

python -c "IPython ๊ฐ€์ ธ์˜ค๊ธฐ; print(IPython.sys_info())" ์ถœ๋ ฅ:

{'์ปค๋ฐ‹_ํ•ด์‹œ': '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 ๋ฉ๋‹ˆ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์ด ์กด์žฌํ•˜๋ฉฐ ์“ฐ๊ธฐ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๊นŒ?

ํžŒํŠธ๋ฅผ ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ํŒŒ์ผ์— ์ž˜๋ชป๋œ ๊ถŒํ•œ์ด ์žˆ์Šต๋‹ˆ๋‹ค(์“ฐ๊ธฐ ๋ถˆ๊ฐ€๋Šฅ). ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€/์ถœ๋ ฅ์„ ๊ฐœ์„ ํ•  ๊ฒƒ์„ ์ œ์•ˆํ•ฉ๋‹ˆ๋‹ค.

๋ฌธ์ œ ๋ณด๊ณ ์„œ์— ํŒŒ์ผ์„ ์ฒจ๋ถ€ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์œผ๋ฉด ์ข‹์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์š”์  ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ž…๋‹ˆ๋‹ค.

์ด๋ฏธ ์ปค๋ฐ‹๋œ ๋ฌธ์ œ๋ฅผ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค(!!).

๊ฒ€์ƒ‰ ํ•„๋“œ๋Š” ํŽ˜์ด์ง€ ์ƒ๋‹จ์— ์žˆ์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ์ด๊ฒƒ์„ ์‹œ๋„ํ–ˆ๊ณ  ํšจ๊ณผ๊ฐ€ ์žˆ์—ˆ๋‹ค. @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 ๋“ฑ๊ธ‰