How can I change the default pager for Python's help() debugger command?
I'm currently doing some work in a server (Ubuntu) without admin rights nor contact with the administrator. When using the help(command)
in the python command line I get an error.
Here's an example:
>>> help(someCommand)
/bin/sh: most: command not found
So, this error indicates that most pager is not currently installed. However, the server I'm working on has "more" and "less" pagers installed. So, how can I change the default pager configuration for this python utility?
Solution 1:
This one is annoyingly difficult to research, but I think I found it.
The built-in help
generates its messages using the standard library pydoc
module (the module is also intended to be usable as a standalone script). In that documentation, we find:
When printing output to the console, pydoc attempts to paginate the output for easier reading. If the
PAGER
environment variable is set, pydoc will use its value as a pagination program.
So, presumably, that's been set to most
on your system. Assuming it won't break anything else on your system, just unset or change it. (It still pages without a value set - even on Windows. I assume it has a built-in fallback.)