Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

549
Views
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?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

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.)

over 4 years ago · Santiago Trujillo Report

0

You can make a custom most script that just invokes less (or even more).

The steps would be:

  1. Set up a script called most, the contents of which are:
    #!/bin/sh
    less ${@:1}  # wierdess is just "all arguments except argument 0"
  1. Put that script in a location that is on your PATH

Then most filename should just run less on that file, and that command should get called from in your python interpreter.

To be honest though, I'd just use Karl's approach.

over 4 years ago · Santiago Trujillo Report

0

You can view the various pager options in the source code. That function can be replaced to return whatever is desired. For example:

import pydoc

pydoc.getpager = lambda: lambda text: pydoc.pipepager(text, 'less')
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!