Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15757 > unrolled thread

python shell that saves history of typed in commands that will persist between reboots

Started bygoldtech <goldtech@worldpost.com>
First post2011-11-15 19:38 -0800
Last post2011-11-27 17:20 -0800
Articles 20 on this page of 27 — 13 participants

Back to article view | Back to comp.lang.python


Contents

  python shell that saves history of typed in commands that will persist between reboots goldtech <goldtech@worldpost.com> - 2011-11-15 19:38 -0800
    Re: python shell that saves history of typed in commands that will persist between reboots sword <john.37@gmail.com> - 2011-11-15 19:45 -0800
    Re: python shell that saves history of typed in commands that will persist between reboots Tim Golden <mail@timgolden.me.uk> - 2011-11-16 08:37 +0000
    Re: python shell that saves history of typed in commands that will persist between reboots Ben Finney <ben+python@benfinney.id.au> - 2011-11-17 08:09 +1100
      Re: python shell that saves history of typed in commands that will persist between reboots David Robinow <drobinow@gmail.com> - 2011-11-16 18:46 -0500
        Re: python shell that saves history of typed in commands that will persist between reboots Ben Finney <ben+python@benfinney.id.au> - 2011-11-17 10:59 +1100
          Re: python shell that saves history of typed in commands that will persist between reboots David Robinow <drobinow@gmail.com> - 2011-11-16 19:49 -0500
          Re: python shell that saves history of typed in commands that will persist between reboots Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-11-24 15:05 +0100
      Re: python shell that saves history of typed in commands that will persist between reboots alex23 <wuwei23@gmail.com> - 2011-11-16 19:04 -0800
    Re: python shell that saves history of typed in commands that will persist between reboots Anssi Saari <as@sci.fi> - 2011-11-23 11:23 +0200
      Re: python shell that saves history of typed in commands that will persist between reboots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-23 10:29 +0000
        Re: python shell that saves history of typed in commands that will persist between reboots Tim Golden <mail@timgolden.me.uk> - 2011-11-23 10:37 +0000
          Re: python shell that saves history of typed in commands that will persist between reboots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-24 02:16 +0000
            Re: python shell that saves history of typed in commands that will persist between reboots Chris Angelico <rosuav@gmail.com> - 2011-11-24 15:30 +1100
              Re: python shell that saves history of typed in commands that will persist between reboots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-24 06:11 +0000
                Re: python shell that saves history of typed in commands that will persist between reboots Chris Angelico <rosuav@gmail.com> - 2011-11-24 17:22 +1100
                Re: python shell that saves history of typed in commands that will persist between reboots Tim Golden <mail@timgolden.me.uk> - 2011-11-24 08:51 +0000
                  Re: python shell that saves history of typed in commands that will persist between reboots alex23 <wuwei23@gmail.com> - 2011-11-24 19:49 -0800
                    Re: python shell that saves history of typed in commands that will persist between reboots Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-11-25 11:37 +0100
                      Re: python shell that saves history of typed in commands that will persist between reboots Tim Golden <mail@timgolden.me.uk> - 2011-11-25 11:29 +0000
                        Re: python shell that saves history of typed in commands that will persist between reboots 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-25 15:19 -0800
                        Re: python shell that saves history of typed in commands that will persist between reboots 88888 Dihedral <dihedral88888@googlemail.com> - 2011-11-25 15:19 -0800
                Re: python shell that saves history of typed in commands that will persist between reboots Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-11-24 10:11 -0800
          Re: python shell that saves history of typed in commands that will persist between reboots alex23 <wuwei23@gmail.com> - 2011-11-24 19:47 -0800
            Re: python shell that saves history of typed in commands that will persist between reboots Tim Golden <mail@timgolden.me.uk> - 2011-11-25 08:58 +0000
              Re: python shell that saves history of typed in commands that will persist between reboots alex23 <wuwei23@gmail.com> - 2011-11-25 19:42 -0800
    Re: python shell that saves history of typed in commands that will persist between reboots DevPlayer <devplayer@gmail.com> - 2011-11-27 17:20 -0800

Page 1 of 2  [1] 2  Next page →


#15757 — python shell that saves history of typed in commands that will persist between reboots

Fromgoldtech <goldtech@worldpost.com>
Date2011-11-15 19:38 -0800
Subjectpython shell that saves history of typed in commands that will persist between reboots
Message-ID<4737007e-029d-4ecb-9315-f3ceb4bb06ed@t16g2000vba.googlegroups.com>
Hi,

Using Windows. Is there a python shell that has a history of typed in
commands?

I don't need output of commands just what I typed it. I need it to
save between sessions - something that no shell seems to do. If I
reboot there will still be a command history somewhere.

Like bash history in Linux.

Thanks

[toc] | [next] | [standalone]


#15758

Fromsword <john.37@gmail.com>
Date2011-11-15 19:45 -0800
Message-ID<905c6590-84e0-4eab-80bd-3daf12d0a326@y15g2000prl.googlegroups.com>
In reply to#15757
Maybe you're looking for ipython? History, tab-complete, sort of
things in it.

goldtech wrote:
> Hi,
>
> Using Windows. Is there a python shell that has a history of typed in
> commands?
>
> I don't need output of commands just what I typed it. I need it to
> save between sessions - something that no shell seems to do. If I
> reboot there will still be a command history somewhere.
>
> Like bash history in Linux.
>
> Thanks

[toc] | [prev] | [next] | [standalone]


#15765

FromTim Golden <mail@timgolden.me.uk>
Date2011-11-16 08:37 +0000
Message-ID<mailman.2762.1321432671.27778.python-list@python.org>
In reply to#15757
On 16/11/2011 03:38, goldtech wrote:
> Hi,
>
> Using Windows. Is there a python shell that has a history of typed in
> commands?

Have a look at DreamPie:

http://dreampie.sourceforge.net/

TJG

[toc] | [prev] | [next] | [standalone]


#15789

FromBen Finney <ben+python@benfinney.id.au>
Date2011-11-17 08:09 +1100
Message-ID<8762ijlqpt.fsf@benfinney.id.au>
In reply to#15757
goldtech <goldtech@worldpost.com> writes:

> Using Windows. Is there a python shell that has a history of typed in
> commands?

I don't know about MS Windows, but the Python interactive shell can be
linked with the GNU Readline library for managing its command line
<URL:http://docs.python.org/library/readline.html> including editing
features, tab completion, history management, and a persistent history
file.

You can then use that functionality in your Python interactive startup
file. Here's mine:

=====
# $HOME/.pythonrc
# User configuration for interactive Python shell.

import sys
import os
import os.path
import atexit

# Tab completion with readline.
# Cribbed from <URL:http://docs.python.org/lib/module-rlcompleter.html>.
try:
    import readline
except ImportError:
    sys.stderr.write("Module readline not available.\n")
else:
    import rlcompleter

    # Enable tab completion.
    readline.parse_and_bind("tab: complete")

    # Persistent command history.
    histfile = os.path.join(os.environ["HOME"], ".python_history") 
    try:
        readline.read_history_file(histfile)
    except IOError:
        # Existing history file can't be read.
        pass 
    atexit.register(readline.write_history_file, histfile)

    del histfile

del sys, os, atexit

=====

Reading the documentation, I see that the ‘readline’ library is only
linked with Python on Unix-alike operating systems. Yet another reason
why MS Windows is not a good choice for developing software I guess.

-- 
 \        “The difference between religions and cults is determined by |
  `\                      how much real estate is owned.” —Frank Zappa |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#15793

FromDavid Robinow <drobinow@gmail.com>
Date2011-11-16 18:46 -0500
Message-ID<mailman.2786.1321487193.27778.python-list@python.org>
In reply to#15789
On Wed, Nov 16, 2011 at 4:09 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> goldtech <goldtech@worldpost.com> writes:
>
>> Using Windows. Is there a python shell that has a history of typed in
>> commands?
>
> I don't know about MS Windows, but the Python interactive shell can be
> linked with the GNU Readline library for managing its command line
> <URL:http://docs.python.org/library/readline.html> including editing
> features, tab completion, history management, and a persistent history
> file.
>
> You can then use that functionality in your Python interactive startup
> file. Here's mine:
>
> =====
> # $HOME/.pythonrc
> # User configuration for interactive Python shell.
>
> import sys
> import os
> import os.path
> import atexit
>
> # Tab completion with readline.
> # Cribbed from <URL:http://docs.python.org/lib/module-rlcompleter.html>.
> try:
>    import readline
> except ImportError:
>    sys.stderr.write("Module readline not available.\n")
> else:
>    import rlcompleter
>
>    # Enable tab completion.
>    readline.parse_and_bind("tab: complete")
>
>    # Persistent command history.
>    histfile = os.path.join(os.environ["HOME"], ".python_history")
>    try:
>        readline.read_history_file(histfile)
>    except IOError:
>        # Existing history file can't be read.
>        pass
>    atexit.register(readline.write_history_file, histfile)
>
>    del histfile
>
> del sys, os, atexit
>
> =====
>
> Reading the documentation, I see that the ‘readline’ library is only
> linked with Python on Unix-alike operating systems. Yet another reason
> why MS Windows is not a good choice for developing software I guess.

 I'm not sure what documentation you're reading, but your code works fine on
 Windows.   Thanks.  [It is necessary to properly set PYTHONSTARTUP]

[toc] | [prev] | [next] | [standalone]


#15794

FromBen Finney <ben+python@benfinney.id.au>
Date2011-11-17 10:59 +1100
Message-ID<87hb23ei00.fsf@benfinney.id.au>
In reply to#15793
David Robinow <drobinow@gmail.com> writes:

> On Wed, Nov 16, 2011 at 4:09 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> > I don't know about MS Windows, but the Python interactive shell can be
> > linked with the GNU Readline library for managing its command line
> > <URL:http://docs.python.org/library/readline.html>
[…]

> > Reading the documentation, I see that the ‘readline’ library is only
> > linked with Python on Unix-alike operating systems.

>  I'm not sure what documentation you're reading

The same documentation I linked to above. Immediately below the title,
it specifies a limited set of platforms: “Platforms: Unix” limiting the
availability of the described module.

> but your code works fine on Windows. Thanks.

I'm glad to know that. Perhaps you could investigate why, and suggest an
update to the above documentation if it's wrong? The bug tracker at
<URL:http://bugs.python.org/> would be the appropriate place for such a
suggestion.

-- 
 \        “Intellectual property is to the 21st century what the slave |
  `\                              trade was to the 16th.” —David Mertz |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#15796

FromDavid Robinow <drobinow@gmail.com>
Date2011-11-16 19:49 -0500
Message-ID<mailman.2788.1321490973.27778.python-list@python.org>
In reply to#15794
On Wed, Nov 16, 2011 at 6:59 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
> David Robinow <drobinow@gmail.com> writes:
>
>> On Wed, Nov 16, 2011 at 4:09 PM, Ben Finney <ben+python@benfinney.id.au> wrote:
>> > I don't know about MS Windows, but the Python interactive shell can be
>> > linked with the GNU Readline library for managing its command line
>> > <URL:http://docs.python.org/library/readline.html>
> […]
>
>> > Reading the documentation, I see that the ‘readline’ library is only
>> > linked with Python on Unix-alike operating systems.
>
>>  I'm not sure what documentation you're reading
>
> The same documentation I linked to above. Immediately below the title,
> it specifies a limited set of platforms: “Platforms: Unix” limiting the
> availability of the described module.
>
>> but your code works fine on Windows. Thanks.
>
> I'm glad to know that. Perhaps you could investigate why, and suggest an
> update to the above documentation if it's wrong? The bug tracker at
> <URL:http://bugs.python.org/> would be the appropriate place for such a
> suggestion.

Upon further investigation, it turns out that I'm using pyreadline
from http://pypi.python.org/pypi/pyreadline. I'd forgotten I'd
installed it. No documentation fixes appear to be necessary.

"The pyreadline package is a python implementation of GNU readline
functionality it is based on the ctypes based UNC readline package by
Gary Bishop. It is not complete. It has been tested for use with
windows 2000 and windows xp."
  It appears to work in Vista also, at least for the purposes
discussed in this thread.

[toc] | [prev] | [next] | [standalone]


#16164

FromUlrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Date2011-11-24 15:05 +0100
Message-ID<4jv1q8-sv.ln1@satorlaser.homedns.org>
In reply to#15794
Am 17.11.2011 00:59, schrieb Ben Finney:
> David Robinow<drobinow@gmail.com>  writes:
>> but your code works fine on Windows. Thanks.
>
> I'm glad to know that. Perhaps you could investigate why, and suggest an
> update to the above documentation if it's wrong? The bug tracker at
> <URL:http://bugs.python.org/>  would be the appropriate place for such a
> suggestion.

Interestingly, on MS Windows (XP here), every commandline program 
inherits the history functionality (browsing with cursor up/down) from 
the shell it runs in. That means the program itself doesn't have to 
supply any of that, but also that it can't customize any of that...

The history is not persistent though, it is restricted to that shell. 
Still, this might explain why it never bothered anyone enough to fix 
things properly. ;)

Uli

[toc] | [prev] | [next] | [standalone]


#15802

Fromalex23 <wuwei23@gmail.com>
Date2011-11-16 19:04 -0800
Message-ID<3ed98382-5d03-4491-a24a-032f47f5ed5c@u24g2000pru.googlegroups.com>
In reply to#15789
On Nov 17, 7:09 am, Ben Finney <ben+pyt...@benfinney.id.au> wrote:
> You can then use that functionality in your Python interactive startup
> file. Here's mine:

Awesome, thank you for this. I use iPython where ever possible but
there are times where I just can't avoid the default shell and this
will help immensely.

Cheers!

[toc] | [prev] | [next] | [standalone]


#16100

FromAnssi Saari <as@sci.fi>
Date2011-11-23 11:23 +0200
Message-ID<vg38vn7dwfs.fsf@sci.fi>
In reply to#15757
goldtech <goldtech@worldpost.com> writes:

> Using Windows. Is there a python shell that has a history of typed in
> commands?

Is there a shell that doesn't have history then? At least both the
vanilla shell and Idle both have basic history in Windows. IPython for
more fun.

[toc] | [prev] | [next] | [standalone]


#16101

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-11-23 10:29 +0000
Message-ID<4ecccb07$0$29993$c3e8da3$5496439d@news.astraweb.com>
In reply to#16100
On Wed, 23 Nov 2011 11:23:19 +0200, Anssi Saari wrote:

> goldtech <goldtech@worldpost.com> writes:
> 
>> Using Windows. Is there a python shell that has a history of typed in
>> commands?
> 
> Is there a shell that doesn't have history then? At least both the
> vanilla shell and Idle both have basic history in Windows. IPython for
> more fun.

The default interactive interpreter for Python doesn't have persistent 
history, so if you exit the interpreter and restart it, your commands are 
gone.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#16102

FromTim Golden <mail@timgolden.me.uk>
Date2011-11-23 10:37 +0000
Message-ID<mailman.2965.1322044680.27778.python-list@python.org>
In reply to#16101
On 23/11/2011 10:29, Steven D'Aprano wrote:
> On Wed, 23 Nov 2011 11:23:19 +0200, Anssi Saari wrote:
>
>> goldtech<goldtech@worldpost.com>  writes:
>>
>>> Using Windows. Is there a python shell that has a history of typed in
>>> commands?
>>
>> Is there a shell that doesn't have history then? At least both the
>> vanilla shell and Idle both have basic history in Windows. IPython for
>> more fun.
>
> The default interactive interpreter for Python doesn't have persistent
> history, so if you exit the interpreter and restart it, your commands are
> gone.

Not quite

The interpreter inherits the command shell's history function:
Open a cmd window and then a Python session. Do some stuff.

Ctrl-Z to exit to the surrounding cmd window.
Do some random cmd stuff: dir, cd, etc.

Start a second Python session. up-arrow etc. will bring back
the previous Python session's commands (and not the ones you
entered in the surrounding shell)

Obviously this only applies when an underlying cmd session
persists -- if you simply start Python from Start > Run
twice the command history will not persist between sessions.

TJG

[toc] | [prev] | [next] | [standalone]


#16136

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-11-24 02:16 +0000
Message-ID<4ecda8ea$0$30003$c3e8da3$5496439d@news.astraweb.com>
In reply to#16102
On Wed, 23 Nov 2011 10:37:56 +0000, Tim Golden wrote:

> The interpreter inherits the command shell's history function: Open a
> cmd window and then a Python session. Do some stuff.
> 
> Ctrl-Z to exit to the surrounding cmd window. Do some random cmd stuff:
> dir, cd, etc.
> 
> Start a second Python session. up-arrow etc. will bring back the
> previous Python session's commands (and not the ones you entered in the
> surrounding shell)

Doesn't work for me, at least not with Python 2.5 and 2.6 on Linux.

I don't suppose you are running a site-specific command history script in 
your startup.py file?


[steve@wow-wow ~]$ unset PYTHONSTARTUP
[steve@wow-wow ~]$ python
Python 2.5 (r25:51908, Nov  6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 42
42
>>>
[1]+  Stopped                 python
[steve@wow-wow ~]$ python
Python 2.5 (r25:51908, Nov  6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


You can't see it, but I'm hitting the up arrow on that last line, and 
nothing is happening except my console is flashing :)


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#16145

FromChris Angelico <rosuav@gmail.com>
Date2011-11-24 15:30 +1100
Message-ID<mailman.2990.1322109066.27778.python-list@python.org>
In reply to#16136
On Thu, Nov 24, 2011 at 1:16 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Wed, 23 Nov 2011 10:37:56 +0000, Tim Golden wrote:
>
>> The interpreter inherits the command shell's history function: Open a
>> cmd window and then a Python session. Do some stuff.
>>
>> Ctrl-Z to exit to the surrounding cmd window. Do some random cmd stuff:
>> dir, cd, etc.
>>>>
> [1]+  Stopped                 python

Ctrl-Z is the Windows equivalent (well, mostly) of Linux's Ctrl-D. You
want to cleanly exit the interpreter, not SIGSTOP it.

ChrisA

[toc] | [prev] | [next] | [standalone]


#16147

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-11-24 06:11 +0000
Message-ID<4ecde007$0$30003$c3e8da3$5496439d@news.astraweb.com>
In reply to#16145
On Thu, 24 Nov 2011 15:30:57 +1100, Chris Angelico wrote:

> On Thu, Nov 24, 2011 at 1:16 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> On Wed, 23 Nov 2011 10:37:56 +0000, Tim Golden wrote:
>>
>>> The interpreter inherits the command shell's history function: Open a
>>> cmd window and then a Python session. Do some stuff.
>>>
>>> Ctrl-Z to exit to the surrounding cmd window. Do some random cmd
>>> stuff: dir, cd, etc.
>>>>>
>> [1]+  Stopped                 python
> 
> Ctrl-Z is the Windows equivalent (well, mostly) of Linux's Ctrl-D. You
> want to cleanly exit the interpreter, not SIGSTOP it.


One of us is confused, and I'm pretty sure it's you :)

Tim went on to say "Obviously this only applies when an underlying cmd 
session persists", which I understood as implying that he too is using 
Linux where Ctrl-Z stops the process, but does not exit it.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#16149

FromChris Angelico <rosuav@gmail.com>
Date2011-11-24 17:22 +1100
Message-ID<mailman.2993.1322115757.27778.python-list@python.org>
In reply to#16147
On Thu, Nov 24, 2011 at 5:11 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> One of us is confused, and I'm pretty sure it's you :)
>
> Tim went on to say "Obviously this only applies when an underlying cmd
> session persists", which I understood as implying that he too is using
> Linux where Ctrl-Z stops the process, but does not exit it.

Entirely possible :) I blithely assumed from the fact that he said
"dir" that it was Windows, but it goes to show what happens when you
assume.

ChrisA

[toc] | [prev] | [next] | [standalone]


#16156

FromTim Golden <mail@timgolden.me.uk>
Date2011-11-24 08:51 +0000
Message-ID<mailman.2999.1322124705.27778.python-list@python.org>
In reply to#16147
On 24/11/2011 06:22, Chris Angelico wrote:
> On Thu, Nov 24, 2011 at 5:11 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info>  wrote:
>> One of us is confused, and I'm pretty sure it's you :)
>>
>> Tim went on to say "Obviously this only applies when an underlying cmd
>> session persists", which I understood as implying that he too is using
>> Linux where Ctrl-Z stops the process, but does not exit it.
>
> Entirely possible :) I blithely assumed from the fact that he said
> "dir" that it was Windows, but it goes to show what happens when you
> assume.

Ahem. Sorry for any confusion caused. The OP was asking about the
situation on Windows, and I was responding in that context. The
Ctrl-Z thing is what *exits* the interpreter on Windows (a la Ctrl-D
on Linux).

In short - on Windows, within one cmd shell you can open and exit
the interpreter as many times as you like and the Python command
history will be retained via the cmd shell's history mechanism,
and kept distinct from the history of other things you may type
into the cmd shell.

If you exit the cmd shell then that history is lost, and I'm not
aware of any mechanism for retaining it.

All this may or may not be of any use to the OP. I was responding
to this comment by Steven:

"The default interactive interpreter for Python doesn't have persistent
history, so if you exit the interpreter and restart it, your commands
are gone."


TJG

[toc] | [prev] | [next] | [standalone]


#16192

Fromalex23 <wuwei23@gmail.com>
Date2011-11-24 19:49 -0800
Message-ID<bea9a0d9-2971-4d52-9037-a0423af39d4d@v31g2000prg.googlegroups.com>
In reply to#16156
On Nov 24, 6:51 pm, Tim Golden <m...@timgolden.me.uk> wrote:
> The
> Ctrl-Z thing is what *exits* the interpreter on Windows (a la Ctrl-D
> on Linux).

With ActivePython, Ctrl-D works as well, which is a godsend as I'm
constantly working across Windows & linux.

> In short - on Windows, within one cmd shell you can open and exit
> the interpreter as many times as you like and the Python command
> history will be retained via the cmd shell's history mechanism,
> and kept distinct from the history of other things you may type
> into the cmd shell.

And again, I'm definitely not seeing this. Inside the one cmd shell,
each instance of Python has no recollection of the history of the last.

[toc] | [prev] | [next] | [standalone]


#16215

FromUlrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Date2011-11-25 11:37 +0100
Message-ID<qn74q8-o0f.ln1@satorlaser.homedns.org>
In reply to#16192
Am 25.11.2011 04:49, schrieb alex23:
> On Nov 24, 6:51 pm, Tim Golden<m...@timgolden.me.uk>  wrote:
>> The Ctrl-Z thing is what *exits* the interpreter on Windows
>> (a la Ctrl-D on Linux).
>
> With ActivePython, Ctrl-D works as well, which is a godsend as I'm
> constantly working across Windows&  linux.
>
>> In short - on Windows, within one cmd shell you can open and exit
>> the interpreter as many times as you like and the Python command
>> history will be retained via the cmd shell's history mechanism,
>> and kept distinct from the history of other things you may type
>> into the cmd shell.
>
> And again, I'm definitely not seeing this. Inside the one cmd shell,
> each instance of Python has no recollection of the history of the
> last.

I'm seeing history browsing in Python on MS Windows XP here and it also 
works for every other commandline-based program. Well, it seems with the 
exception of the ActivePython distribution of Python. That one 
intentionally changes the MS Windows defaults like Control-Z behaviour 
and at the same time, maybe even as a side effect, it breaks the shell's 
history browsing.

You don't happen to have an installation of the vanilla Python 
distribution to test, do you? This is getting me curious...

Uli

[toc] | [prev] | [next] | [standalone]


#16218

FromTim Golden <mail@timgolden.me.uk>
Date2011-11-25 11:29 +0000
Message-ID<mailman.3037.1322220596.27778.python-list@python.org>
In reply to#16215
On 25/11/2011 10:37, Ulrich Eckhardt wrote:
> Am 25.11.2011 04:49, schrieb alex23:
>> On Nov 24, 6:51 pm, Tim Golden<m...@timgolden.me.uk> wrote:
>>> The Ctrl-Z thing is what *exits* the interpreter on Windows
>>> (a la Ctrl-D on Linux).
>>
>> With ActivePython, Ctrl-D works as well, which is a godsend as I'm
>> constantly working across Windows& linux.
>>
>>> In short - on Windows, within one cmd shell you can open and exit
>>> the interpreter as many times as you like and the Python command
>>> history will be retained via the cmd shell's history mechanism,
>>> and kept distinct from the history of other things you may type
>>> into the cmd shell.
>>
>> And again, I'm definitely not seeing this. Inside the one cmd shell,
>> each instance of Python has no recollection of the history of the
>> last.
>
> I'm seeing history browsing in Python on MS Windows XP here and it also
> works for every other commandline-based program. Well, it seems with the
> exception of the ActivePython distribution of Python. That one
> intentionally changes the MS Windows defaults like Control-Z behaviour
> and at the same time, maybe even as a side effect, it breaks the shell's
> history browsing.

Except that, intriguingly, I'm also using an ActiveState distro
and it neither adds Ctrl-D nor prevents history. But I'm
fairly sure that pyreadline does both of those things.

TJG

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.python


csiph-web