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


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

Disable readline

Started bySteven D'Aprano <steve+comp.lang.python@pearwood.info>
First post2011-12-01 04:17 +0000
Last post2011-12-01 09:30 -0500
Articles 4 — 3 participants

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


Contents

  Disable readline Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-01 04:17 +0000
    Re: Disable readline Roy Smith <roy@panix.com> - 2011-12-01 00:00 -0500
      Re: Disable readline Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-01 06:42 +0000
        Re: Disable readline Nick Dokos <nicholas.dokos@hp.com> - 2011-12-01 09:30 -0500

#16471 — Disable readline

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-12-01 04:17 +0000
SubjectDisable readline
Message-ID<4ed6ffed$0$29986$c3e8da3$5496439d@news.astraweb.com>
Is there a way to disable readline support in the interactive interpreter 
at runtime? Either from within an existing session, or when the session 
starts up will do.

I am trying to test the behaviour of some interactive scripts which rely 
on readline. I have work-arounds for missing readline (such as on Windows 
systems) but no way to test them properly on Linux.

If all else fails, are there any traps or pitfalls in installing a second 
Python installation with readline support disabled?

Any other suggestions?


-- 
Steven

[toc] | [next] | [standalone]


#16475

FromRoy Smith <roy@panix.com>
Date2011-12-01 00:00 -0500
Message-ID<roy-9B9489.00005201122011@news.panix.com>
In reply to#16471
In article <4ed6ffed$0$29986$c3e8da3$5496439d@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:

> Is there a way to disable readline support in the interactive interpreter 
> at runtime? Either from within an existing session, or when the session 
> starts up will do.

I'm assuming Python uses the standard GNU readline().  If that's 
correct, then you can configure its behavior by editing your ~/.inputrc 
file.  Try "man readline".  I don't see any global "disable readline" 
flag, but you may be able to get that effect by deleting all the key 
mappings, or some such silliness.

Another possibility is setting your TERM environment variable to 
something that readline can't support:

~$ TERM=asr33
~$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Cannot read termcap database;
using dumb terminal settings.
Cannot read termcap database;
using dumb terminal settings.
Cannot read termcap database;
using dumb terminal settings.
>>> 

 
> If all else fails, are there any traps or pitfalls in installing a second 
> Python installation with readline support disabled?

None at all, as long as you keep them from stomping on each other.  The 
easiest method is probably to use virtualenv.

BTW, readline is the coolest, awesomist, most frabjulously gnarly thing 
to be invented since the pointed stick.  The idea that somebody would 
want to turn it off (even for testing) disturbs me deeply.

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


#16480

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-12-01 06:42 +0000
Message-ID<4ed721cb$0$29986$c3e8da3$5496439d@news.astraweb.com>
In reply to#16475
On Thu, 01 Dec 2011 00:00:52 -0500, Roy Smith wrote:

> Another possibility is setting your TERM environment variable to
> something that readline can't support:
> 
> ~$ TERM=asr33
> ~$ python
> Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc.
> build 5646)] on darwin Type "help", "copyright", "credits" or "license"
> for more information. Cannot read termcap database;
> using dumb terminal settings.
> Cannot read termcap database;
> using dumb terminal settings.
> Cannot read termcap database;
> using dumb terminal settings.


Damn, my python is smarter than your python.

steve@runes:~$ TERM=asr33
steve@runes:~$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

And readline continues to work :/


I think I'll install from source a build with readline disabled.


> BTW, readline is the coolest, awesomist, most frabjulously gnarly thing
> to be invented since the pointed stick.  The idea that somebody would
> want to turn it off (even for testing) disturbs me deeply.

I know! I don't use more than about 1% of what readline offers, but I 
can't imagine not using it.



-- 
Steven

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


#16498

FromNick Dokos <nicholas.dokos@hp.com>
Date2011-12-01 09:30 -0500
Message-ID<mailman.3199.1322750221.27778.python-list@python.org>
In reply to#16480
Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:

> On Thu, 01 Dec 2011 00:00:52 -0500, Roy Smith wrote:
> 
> > Another possibility is setting your TERM environment variable to
> > something that readline can't support:
> > 
> > ~$ TERM=asr33
> > ~$ python
> > Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc.
> > build 5646)] on darwin Type "help", "copyright", "credits" or "license"
> > for more information. Cannot read termcap database;
> > using dumb terminal settings.
> > Cannot read termcap database;
> > using dumb terminal settings.
> > Cannot read termcap database;
> > using dumb terminal settings.
> 
> 
> Damn, my python is smarter than your python.
> 
> steve@runes:~$ TERM=asr33
> steve@runes:~$ python
> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> 
> 
> And readline continues to work :/
> 

Two things:

o Is TERM exported? Maybe Roy's is and yours isn't.
o Is asr33 in your termcap database?

Try

export TERM=dumb

perhaps?

Nick

> 
> I think I'll install from source a build with readline disabled.
> 
> 
> > BTW, readline is the coolest, awesomist, most frabjulously gnarly thing
> > to be invented since the pointed stick.  The idea that somebody would
> > want to turn it off (even for testing) disturbs me deeply.
> 
> I know! I don't use more than about 1% of what readline offers, but I 
> can't imagine not using it.
> 
> 
> 
> -- 
> Steven
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

[toc] | [prev] | [standalone]


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


csiph-web