Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15793
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!txtfeed1.tudelft.nl!tudelft.nl!txtfeed2.tudelft.nl!amsnews11.chello.com!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <drobinow@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'startup': 0.04; 'sys': 0.05; 'importerror:': 0.07; 'tab': 0.07; 'typed': 0.07; 'python': 0.08; '=====': 0.09; 'ioerror:': 0.09; 'sys,': 0.09; 'read.': 0.10; 'subject:python': 0.11; 'library': 0.14; '16,': 0.15; 'cc:addr:python-list': 0.15; '[it': 0.16; 'atexit': 0.16; 'complete")': 0.16; 'finney': 0.16; 'history.': 0.16; 'subject: \n ': 0.16; 'subject:between': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'systems.': 0.23; 'skip:\xa0 40': 0.23; 'header:In-Reply-To:1': 0.23; 'command': 0.24; 'shell': 0.24; 'cc:2**0': 0.25; 'code': 0.25; 'writes:': 0.25; 'fine': 0.26; 'windows': 0.26; 'thanks.': 0.26; "i'm": 0.26; 'developing': 0.26; 'import': 0.28; 'cc:addr:python.org': 0.29; 'message-id:@mail.gmail.com': 0.29; 'received:209.85.214': 0.30; 'os,': 0.30; 'received:mail-bw0-f46.google.com': 0.30; 'url:library': 0.30; 'nov': 0.31; 'pm,': 0.31; 'skip:\xa0 30': 0.32; 'yet': 0.32; "can't": 0.32; 'there': 0.33; 'operating': 0.33; 'file.': 0.34; '8bit%:3': 0.34; 'try:': 0.34; 'url:python': 0.35; 'file': 0.36; 'skip:" 10': 0.36; 'another': 0.36; 'but': 0.37; 'using': 0.37; 'linked': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; 'url:docs': 0.38; 'except': 0.39; 'why': 0.39; 'subject:: ': 0.39; 'history': 0.40; 'received:209': 0.40; 'user': 0.40; 'managing': 0.60; 'your': 0.61; '2011': 0.62; 'skip:$ 10': 0.63; 'skip:o 30': 0.63; 'subject:will': 0.64; 'enable': 0.65; 'completion': 0.80; 'subject:commands': 0.84; 'subject:history': 0.84; 'url:lib': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Z0+rXihdiJywwNy/3oDw1+lDS7sqKqEaNkUpUqXfeRg=; b=upYC/2FtjC1CdJDRt8J20YEO9voiSwIGL9S7UBqgIc/RK1GbvwiJYlPwAmUC+84H4y O3D94s2D2omMzAuYwZ0k6JSoGurl+MlhmpWCQNL+FCf51r9YZSBm/kUAeldrlT+PbfwC OtP32JrgaC4Lm4nt+SnFGqkD3r+yWSWKaORjM= |
| MIME-Version | 1.0 |
| In-Reply-To | <8762ijlqpt.fsf@benfinney.id.au> |
| References | <4737007e-029d-4ecb-9315-f3ceb4bb06ed@t16g2000vba.googlegroups.com> <8762ijlqpt.fsf@benfinney.id.au> |
| Date | Wed, 16 Nov 2011 18:46:30 -0500 |
| Subject | Re: python shell that saves history of typed in commands that will persist between reboots |
| From | David Robinow <drobinow@gmail.com> |
| To | Ben Finney <ben+python@benfinney.id.au> |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2786.1321487193.27778.python-list@python.org> (permalink) |
| Lines | 59 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1321487193 news.xs4all.nl 6927 [2001:888:2000:d::a6]:37122 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15793 |
Show key headers only | View raw
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]
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web