Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

552
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda