[IPython-User] Shadow history

Jorge Scandaliaris jorgesmbox-ml@yahoo...
Thu Jan 27 11:38:16 CST 2011


Ville M. Vainio <vivainio <at> gmail.com> writes:

> Try running "%clear shist_compress" while running with the old shadow
> history. This consolidates all entries to one entry, in file
> .ipython/db/shadowhist. Then copy over the file to the new ipython
> shadow history instance.
> 


Well, I tried to follow your advice, but shadow history doesn't seem to work at
all in the current trunk (I haven't done anything regarding shadow history here
yet, this a new profile with just a couple of days in use):

ipython
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) 
Type "copyright", "credits" or "license" for more information.

IPython 0.11.dev -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: %hist -g
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/jscandal/sw/ipython/old_shadowhist/profile/<ipython-input-1-fb42983430bd>
in <module>()
----> 1 get_ipython().magic("hist -g")

/home/jscandal/sw/ipython/IPython/core/interactiveshell.pyc in magic(self,
arg_s)
   1750             with nested(self.builtin_trap,):
   1751                 result = fn(magic_args)
-> 1752                 return result
   1753 
   1754     def define_magic(self, magicname, func):

/usr/lib/python2.6/contextlib.pyc in __exit__(self, type, value, traceback)
     32                 value = type()
     33             try:
---> 34                 self.gen.throw(type, value, traceback)
     35                 raise RuntimeError("generator didn't stop after throw()")
     36             except StopIteration, exc:

/usr/lib/python2.6/contextlib.pyc in nested(*managers)
    111             vars.append(enter())
    112             exits.append(exit)
--> 113         yield vars
    114     except:
    115         exc = sys.exc_info()

/home/jscandal/sw/ipython/IPython/core/interactiveshell.pyc in magic(self, 
arg_s)
   1749             magic_args = self.var_expand(magic_args,1)
   1750             with nested(self.builtin_trap,):
-> 1751                 result = fn(magic_args)
   1752                 return result
   1753 

/home/jscandal/sw/ipython/IPython/core/history.pyc in magic_hist(self, 
parameter_s)
    456 def magic_hist(self, parameter_s=''):
    457     """Alternate name for %history."""
--> 458     return self.magic_history(parameter_s)
    459 
    460 

/home/jscandal/sw/ipython/IPython/core/history.pyc in magic_history(self,
arameter_s)
    410     found = False
    411     if pattern is not None:
--> 412         sh = self.shell.history_manager.shadowhist.all()
    413         for idx, s in sh:
    414             if fnmatch.fnmatch(s, pattern):

AttributeError: 'HistoryManager' object has no attribute 'shadowhist'



More information about the IPython-User mailing list