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


Groups > comp.lang.python > #43192

Re: standalone vs embedded interpreter

From Antoine Pitrou <solipsis@pitrou.net>
Subject Re: standalone vs embedded interpreter
Date 2013-04-09 16:13 +0000
References <516434C9.6020705@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.360.1365524014.3114.python-list@python.org> (permalink)

Show all headers | View raw


Nick Gnedin <ngnedin <at> gmail.com> writes:
> I expect it to behave the same way as if I was running it as a 
> standalone program. On Windows this is indeed the case, but on my Linux 
> box (Python 3.3.1 (default, Apr  8 2013, 22:33:31) [GCC 4.1.2 20080704 
> (Red Hat 4.1.2-51)]) I get a different behavior in handling console 
> input. A standalone interpreter cycles though the input history when I 
> use up and down arrows - say, I type this code:
> 
>  >>> 1
> 1
>  >>> a=4
>  >>> a
> 4
> 
> If I now press an <up> key in a standalone interpreter, I get 'a' placed 
> at the prompt (my previous command). However, in an embedded code I get
> 
>  >>> ^[[A
> 
> put at the prompt - does anyone know what I am doing wrong?

Are stdin and stdout both interactive? That is, are isatty(fileno(stdin))
and isatty(fileno(stdout)) both true?

If you want to debug, take a look at PyOS_Readline() in Parser/myreadline.c.
It probably holds the answer to your question.

Regards

Antoine.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: standalone vs embedded interpreter Antoine Pitrou <solipsis@pitrou.net> - 2013-04-09 16:13 +0000

csiph-web