diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 70dfffc..d37b5b4 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -486,7 +486,7 @@ class Kernel(Configurable): raw=raw, output=output) elif hist_access_type == 'search': - n = parent['content']['n'] + n = parent['content'].get('n') pattern = parent['content']['pattern'] hist = self.shell.history_manager.search(pattern, raw=raw, output=output, n=n)