except (ImportError, locale.Error):
pass # no locale support or unsupported locale
- # set displayhook
+ # set displayhook and excepthook
from pprint import pprint
pager = os.environ.get("PAGER") or 'more'
+ # if your pager is 'less', options '-F' and '-R' must be passed to it,
+ # and option '-X' is very much recommended
+ if pager == 'less':
+ less = os.environ.get("LESS") or ''
+ for opt in 'X', 'R', 'F':
+ if opt not in less:
+ less = opt + less
+ os.environ["LESS"] = less
+
class BasePager:
def write(self, value):
self.stdin.write(value)