[Python-ideas] Option of running shell/console commands inside the REPL

Oleg Broytman phd at phdru.name
Sat Feb 2 08:15:48 EST 2019


On Fri, Feb 01, 2019 at 08:43:53PM -0600, eryk sun <eryksun at gmail.com> wrote:
> On 2/1/19, Terry Reedy <tjreedy at udel.edu> wrote:
> > On 2/1/2019 3:31 PM, Oleg Broytman wrote:
> >
> >> Python REPL is missing the following batteries:
> >> * Persistent history;
> 
> Python's built-in REPL relies on the readline module for history. In
> Windows you'll need to install pyreadline, an implementation that uses
> the Windows console API via ctypes.

   Yep, I use it. The question is: Does Python REPL need this battery
preinstalled and preconfigured; or any other battery as well?

> Out of the box, Python uses the the built-in line editing and history
> that's provided by the Windows console host (conhost.exe). There's an
> undocumented function to read this history (as used by doskey.exe),
> but there's no function to load lines into it. I suppose it could be
> replayed manually in a loop that calls WriteConsoleInputW and
> ReadConsoleW.

Oleg.
-- 
    Oleg Broytman            https://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-ideas mailing list