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.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to