How to page output in >>> ?

Discussion in 'Python' started by kj, Aug 12, 2009.

  1. kj

    kj Guest

    How does one tell the python interactive interpreter to run the
    next output to stdout through the default pager? Basically, I'm
    looking for Python's equivalent of Perl's debugger's "|" prefix,
    as in

    DB<1> |print $long_output

    TIA!

    kynn
    kj, Aug 12, 2009
    #1
    1. Advertising

  2. kj

    Nobody Guest

    On Wed, 12 Aug 2009 21:41:38 +0000, kj wrote:

    > How does one tell the python interactive interpreter to run the
    > next output to stdout through the default pager? Basically, I'm
    > looking for Python's equivalent of Perl's debugger's "|" prefix,
    > as in
    >
    > DB<1> |print $long_output


    Something like:

    sys.stdout.flush()
    p = subprocess.Popen([os.environ['PAGER']], stdin = subprocess.PIPE)
    sys.stdout = p.stdin

    ...

    sys.stdout.flush()
    sys.stdout = sys.__stdout__
    p.stdin.close()
    p.wait()

    but with error and exception handling.

    But personally, I'd write the data to the child process explicitly if
    that's possible.
    Nobody, Aug 13, 2009
    #2
    1. Advertising

  3. En Wed, 12 Aug 2009 18:41:38 -0300, kj <> escribió:

    > How does one tell the python interactive interpreter to run the
    > next output to stdout through the default pager? Basically, I'm
    > looking for Python's equivalent of Perl's debugger's "|" prefix,
    > as in
    >
    > DB<1> |print $long_output


    Try using pydoc.pager - read the source

    --
    Gabriel Genellina
    Gabriel Genellina, Aug 13, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Bentley

    Output / Debug window output bug?

    John Bentley, Sep 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    579
    John Bentley
    Sep 10, 2003
  2. zootius
    Replies:
    0
    Views:
    793
    zootius
    Dec 7, 2005
  3. Replies:
    0
    Views:
    452
  4. Paul
    Replies:
    1
    Views:
    424
  5. jmr
    Replies:
    2
    Views:
    320
Loading...

Share This Page