[IPython-user] Problem with ? and ?? in ipython combined with paging
robert.kern at gmail.com
Fri Jan 5 14:02:52 CST 2007
Tom Denniston wrote:
> Much of my code contains long descriptive docstring with many tests.
> There is a great feature that I love in ipython where if you have a
> func and you type "func?" it give a pretty colored docstring that is
> incredibly useful. The nagging problem I face is that if the
> docstring is larger than 25 lines then it invokes the python pager and
> the pretty docstring becomes a garbled mess of "ESC[1;31", etc.
> Below is a docstring that works and one that does and the code that
> produced both. I was wondering whether this is a bug in the python
> pager or ipython and if there is anything that can be done.
What platform are you on? Do you happen to have the environment variable PAGER
set to anything? This is the function that IPython uses to find a suitable pager
# IPython/genutils.py line 1169
def get_pager_cmd(pager_cmd = None):
"""Return a pager command.
Makes some attempts at finding an OS-correct one."""
if os.name == 'posix':
default_pager_cmd = 'less -r' # -r for color control sequences
elif os.name in ['nt','dos']:
default_pager_cmd = 'type'
if pager_cmd is None:
pager_cmd = os.environ['PAGER']
pager_cmd = default_pager_cmd
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the IPython-user