Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - paging in python shell

 
Thread Tools Search this Thread
Old 01-12-2008, 09:45 AM   #1
Default paging in python shell


Hello,

Does anyone know if the python shell supports paging or if I should
look into iPython? Thank you so much.

Alex


Alex K
  Reply With Quote
Old 01-13-2008, 11:36 PM   #2
Tim Roberts
 
Posts: n/a
Default Re: paging in python shell
"Alex K" <> wrote:
>
>Does anyone know if the python shell supports paging or if I should
>look into iPython? Thank you so much.


"Paging" is an overloaded term. What do you mean, exactly? Do you mean
something like piping the output into "more"? The Python shell does that
for the "help" command, but maybe you could post a more precise example of
what you want.
--
Tim Roberts,
Providenza & Boekelheide, Inc.


Tim Roberts
  Reply With Quote
Old 01-14-2008, 08:35 PM   #3
Alex K
 
Posts: n/a
Default Re: paging in python shell
Hi Tim,

Yes I mean piping the output into "more" for example.

Alex

On 14/01/2008, Tim Roberts <> wrote:
> "Alex K" <> wrote:
> >
> >Does anyone know if the python shell supports paging or if I should
> >look into iPython? Thank you so much.

>
> "Paging" is an overloaded term. What do you mean, exactly? Do you mean
> something like piping the output into "more"? The Python shell does that
> for the "help" command, but maybe you could post a more precise example of
> what you want.
> --
> Tim Roberts,
> Providenza & Boekelheide, Inc.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



Alex K
  Reply With Quote
Old 01-14-2008, 08:49 PM   #4
John Machin
 
Posts: n/a
Default Re: paging in python shell
On Jan 15, 7:35 am, "Alex K" <spaceout...@gmail.com> wrote:
> Hi Tim,
>
> Yes I mean piping the output into "more" for example.
>


Why don't you "suck it and see"???

E.g.

C:\junk>copy con demomore.py
for i in range(100):
print 'line', i
^Z
1 file(s) copied.

C:\junk>python demomore.py | more
line 0
line 1
line 2
line 3
line 4
[snip]
line 50
line 51
line 52
line 53
line 54
line 55
line 56
-- More --




John Machin
  Reply With Quote
Old 01-14-2008, 09:01 PM   #5
Alex K
 
Posts: n/a
Default Re: paging in python shell
Thanks John, but would it be possible to remain in the python interpreter?

On 14/01/2008, John Machin <> wrote:
> On Jan 15, 7:35 am, "Alex K" <spaceout...@gmail.com> wrote:
> > Hi Tim,
> >
> > Yes I mean piping the output into "more" for example.
> >

>
> Why don't you "suck it and see"???
>
> E.g.
>
> C:\junk>copy con demomore.py
> for i in range(100):
> print 'line', i
> ^Z
> 1 file(s) copied.
>
> C:\junk>python demomore.py | more
> line 0
> line 1
> line 2
> line 3
> line 4
> [snip]
> line 50
> line 51
> line 52
> line 53
> line 54
> line 55
> line 56
> -- More --
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



Alex K
  Reply With Quote
Old 01-14-2008, 11:05 PM   #6
Ben Finney
 
Posts: n/a
Default Re: paging in python shell
John Machin <> writes:

> C:\junk>python demomore.py | more


Your example uses the OS shell to invoke a pager on the output of the
Python process. The OP was asking about paging *within* the Python
shell.

To my knowledge there's nothing in the default Python shell that
enables what the OP is asking for. There are other Python shells, e.g.
Idle, ipython, or a Python window inside Emacs, that may be better
suited.

--
\ "Compulsory unification of opinion achieves only the unanimity |
`\ of the graveyard." -- Justice Roberts in 319 U.S. 624 (1943) |
_o__) |
Ben Finney


Ben Finney
  Reply With Quote
Old 01-15-2008, 06:17 AM   #7
Alex K
 
Posts: n/a
Default Re: paging in python shell
Thanks it's good to know. iPyton looks really neat.

On 15/01/2008, Ben Finney <bignose+hates-> wrote:
> John Machin <> writes:
>
> > C:\junk>python demomore.py | more

>
> Your example uses the OS shell to invoke a pager on the output of the
> Python process. The OP was asking about paging *within* the Python
> shell.
>
> To my knowledge there's nothing in the default Python shell that
> enables what the OP is asking for. There are other Python shells, e.g.
> Idle, ipython, or a Python window inside Emacs, that may be better
> suited.
>
> --
> \ "Compulsory unification of opinion achieves only the unanimity |
> `\ of the graveyard." -- Justice Roberts in 319 U.S. 624 (1943) |
> _o__) |
> Ben Finney
> --
> http://mail.python.org/mailman/listinfo/python-list
>



Alex K
  Reply With Quote
Old 01-21-2008, 06:22 AM   #8
Gabriel Genellina
 
Posts: n/a
Default Re: paging in python shell
En Mon, 14 Jan 2008 21:05:38 -0200, Ben Finney
<bignose+hates-> escribi�:

> To my knowledge there's nothing in the default Python shell that
> enables what the OP is asking for. There are other Python shells, e.g.
> Idle, ipython, or a Python window inside Emacs, that may be better
> suited.


Yes, there is. Thanks to Tim Roberts who menctioned that the builtin help
system implements paging internally, I looked at it. It's easy to use (but
maybe too late for the OP):

Let Python determine the best pager available:

import pydoc
pydoc.pager(text)

(it may pipe the text into an external program like less or more). Or
explicitely use the builtin pager:

import pydoc
pydoc.ttypager(text)


--
Gabriel Genellina



Gabriel Genellina
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX: 2ND GIG (VOLUME 3) and more! DVD Verdict DVD Video 0 03-09-2006 09:22 AM
DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX: 2ND GIG (VOLUME 2) and more! DVD Verdict DVD Video 0 01-19-2006 09:34 AM
DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX (VOLUME 4) and more! DVD Verdict DVD Video 0 04-21-2005 09:10 AM
DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX (VOLUME 3) and more! DVD Verdict DVD Video 0 01-20-2005 10:12 AM
DVD Verdict reviews: GHOST IN THE SHELL: STAND ALONE COMPLEX (VOLUME 1) and more! DVD Verdict DVD Video 0 08-05-2004 10:03 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46