* How do I get a Python REPL in Eshell on M$ Windows?
@ 2022-06-04 23:08 Eduardo Ochs
2022-06-05 5:14 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Ochs @ 2022-06-04 23:08 UTC (permalink / raw)
To: help-gnu-emacs
Hi list,
I have many students who sort of "want to learn GNU/Linux when they
grow up", but usually they take years between the "want to" stage and
the stage in which they have some kind of GNU/Linux installed in their
machines - either in a VM or in a partition - and several more years
between that stage and the stage in which they become minimally
proficient with a shell...
I'm trying to change that. The details are not important to my
question, but here is a link to them, for the sake of completeness:
http://angg.twu.net/eev-wconfig.html
Anyway, here is my question.
When my students try to run Python in a buffer created with M-x shell
or M-x eshell they don't get an interactive REPL - they get something
that _looks like_ a REPL that is stuck because of bad terminal
settings. In Lua we were able to fix that by running "lua52.exe -i"
instead of just "lua52.exe"... anyone knows how to do something
similar for Python?
Here is what one student got in his *eshell* buffer:
Welcome to the Emacs shell
~ $ ~/eev-wconfig/lua52.exe -i
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> print(2+3)
5
> os.exit()
~ $
~ $ py
print(2+3)
print(2+3)
He sent me a photo of what he got when he ran "py" in a "normal"
terminal running PowerShell. It was something like this:
Windows PowerShell
Copyright (C) Microsoft Corporation. Todos os direitos reservados.
Experimente a nova plataforma cruzada PowerShell https://aka.ms/pscore6
PS C:\Users\ferob> py
Python 3.10.4 [etc etc etc]
>>> print(2+3)
5
>>>
Thanks in advance!
Eduardo Ochs
http://angg.twu.net/#eev
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How do I get a Python REPL in Eshell on M$ Windows?
2022-06-04 23:08 How do I get a Python REPL in Eshell on M$ Windows? Eduardo Ochs
@ 2022-06-05 5:14 ` Eli Zaretskii
2022-06-05 16:59 ` Bruno Barbier
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2022-06-05 5:14 UTC (permalink / raw)
To: help-gnu-emacs
> From: Eduardo Ochs <eduardoochs@gmail.com>
> Date: Sat, 4 Jun 2022 20:08:17 -0300
>
> When my students try to run Python in a buffer created with M-x shell
> or M-x eshell they don't get an interactive REPL - they get something
> that _looks like_ a REPL that is stuck because of bad terminal
> settings. In Lua we were able to fix that by running "lua52.exe -i"
> instead of just "lua52.exe"... anyone knows how to do something
> similar for Python?
>
> Here is what one student got in his *eshell* buffer:
>
> Welcome to the Emacs shell
>
> ~ $ ~/eev-wconfig/lua52.exe -i
> Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> > print(2+3)
> 5
> > os.exit()
> ~ $
> ~ $ py
> print(2+3)
> print(2+3)
>
> He sent me a photo of what he got when he ran "py" in a "normal"
> terminal running PowerShell. It was something like this:
>
> Windows PowerShell
> Copyright (C) Microsoft Corporation. Todos os direitos reservados.
>
> Experimente a nova plataforma cruzada PowerShell https://aka.ms/pscore6
>
> PS C:\Users\ferob> py
> Python 3.10.4 [etc etc etc]
> >>> print(2+3)
> 5
> >>>
I believe the buffering of Python interpreter's stdout can also be
controlled. Search the Internet for "how to make python standard
output unbuffered", and you will find the answers.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How do I get a Python REPL in Eshell on M$ Windows?
2022-06-05 5:14 ` Eli Zaretskii
@ 2022-06-05 16:59 ` Bruno Barbier
0 siblings, 0 replies; 3+ messages in thread
From: Bruno Barbier @ 2022-06-05 16:59 UTC (permalink / raw)
To: Eli Zaretskii, help-gnu-emacs
Hi Eduardo,
Eli Zaretskii <eliz@gnu.org> writes:
>
> I believe the buffering of Python interpreter's stdout can also be
> controlled. Search the Internet for "how to make python standard
> output unbuffered", and you will find the answers.
Yes, outputs are buffered by default, plus, python tries to detect if it's an
interactive shell.
So, with Emacs 'shell', I'm using:
python -i -u
'-i' to force an interactive python
'-u' to force unbuffered outputs
Bruno
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-05 16:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-04 23:08 How do I get a Python REPL in Eshell on M$ Windows? Eduardo Ochs
2022-06-05 5:14 ` Eli Zaretskii
2022-06-05 16:59 ` Bruno Barbier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).