GNU bug report logs - #71440
Python Inferior Mode Can’t Recognize My Prompt

Previous Next

Package: emacs;

Reported by: "shynur ." <one.last.kiss <at> outlook.com>

Date: Sat, 8 Jun 2024 16:36:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #32 received at 71440 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "shynur ." <one.last.kiss <at> outlook.com>
Cc: 71440 <at> debbugs.gnu.org
Subject: Re: 
 Re: bug#71440: Python Inferior Mode Can’t Recognize My
 Prompt
Date: Sun, 09 Jun 2024 13:25:43 +0300
> From: "shynur ." <one.last.kiss <at> outlook.com>
> CC: "71440 <at> debbugs.gnu.org" <71440 <at> debbugs.gnu.org>
> Date: Sun, 9 Jun 2024 10:11:29 +0000
> msip_labels:
> 
> The problem occurs when I call ‘python-shell-send-buffer’
> from a Python buffer, as mentioned in my original post:
> <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71440#5>.

I know almost nothing about Python, but I wonder how PS1 and PS2 are
at all relevant when using python-shell-send-buffer?  That function
sends the buffer text to Python, so where do PS1 and PS2 come into
play, and why does Python say "__PYTHON_EL_eval is not defined" just
because you have PS1 and PS2 customized?

If someone helps me understand that, maybe I will have further ideas.

> > I suggest to define PS1 and PS2 specially for the inferior Python.
> 
> I have to say that this is hard to implement cleanly.
> 
> I’ve tried:
> 
>     (setopt python-shell-interpreter-args "-i -c sys.ps1,sys.ps2='►▻'")
> 
> but it turned out that the ‘PYTHONSTARTUP’ file is loaded 
> after the statement following ‘-c’ is executed.

How about defining PYTHONSTARTUP to point to a different file?

> I think this can be a feature request: provide an option 
> to ignore any setting-color character sequence (eg `\033[32m`)
> in XXYYZZ Inferior Mode, because there’re so many REPL
> apps using a colored prompt and Emacs may not handle them
> properly.

I'm not sure I even understand how the color settings are relevant to
python-shell-send-buffer.




This bug report was last modified 1 year and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.