i performed pip install --upgrade ipython
recently, updating old ipython version 0.13.2. since ipython started using sqlite file storing history.
apparently old history file in $home/.ipython/history intact, not used. instead new folder profile_default
created history.sqlite
file in it, without importing previous ipython commandline-history entries.
any advice on previous history , running again or how import text-history history.sqlite
database, helpful.
it's straighforward iterate on lines of old history file, , write new session new history via historymanager
object:
from ipython.core.interactiveshell import interactiveshell ipython.core.history import historymanager def migrate_history(old_histfile, new_histfile): """populate ipython sqlite history old readline history file""" # shell = interactiveshell.instance() history = historymanager(hist_file=new_histfile, # line shouldn't necessary, in 0.13 shell = interactiveshell.instance() ) open(old_histfile) f: # iterate through readline history, # , write new history database linenum, line in enumerate(f): history.store_inputs(linenum, line)
this function as script, can run once old ipython history new one.
Comments
Post a Comment