Closed guibor closed 1 year ago
Is this a new behavior?
It's hard to know, I just updated my configuration to the latest develop
.
I have this error even when I use the python
layer as is, with no modifications.
It's hard to know, I just updated my configuration to the latest develop.
it's not hard to know.
do you see this error before your recent update?
My previous setup used elpy
(and lispy
as well) and was very different.
I don't think it is related to something that changed recently in spacemacs, but I would be happy for pointers on how to solve this (this happens with the default python layer setup without any modification). From what I read in various places, it is probably related to Mac OS X and various issues with readline
but I'm not an expert. Happy to provide more details if it can help find a solution.
if it's not related to spacemacs you should ask it elsewhere like reddit or stack overflow.
It is related to the Spacemacs Python layer and how it works with the REPL.
I have a fairly standard Mac OS X setup and am using the vanilla spacemacs Python layer as is in the develop branch to set it all up, with no modifications. I just can't say if the issue is a new behavior or not since I wasn't using the Python layer as is before.
how is this related to spacemacs?
can you reproduce the issue with emacs -Q?
After a lot of tinkering, the solution was to use
(setq python-shell-interpreter "ipython" python-shell-interpreter-args " -i )))
Previously the interpreter used the --simple-prompt
flag and this led to the weird printouts.
This is related to spacemacs since this flag is configured in spacemacs//python-setup-shell
. I'm not entirely sure when this flag should or should not be used, I remember having problems not using it in the past.
(on a side note, once this was changed, I still wasn't completely happy because the statements sent to the shell were not echoed, and I solved this by using a different function to send to shell).
what's your ipython version?
8.12
as long as the ipython version is greater than 5, it won't use --simple-prompt.
you should check whether emacs is using the correct ipython.
(replace-regexp-in-string
"\\(\\.dev\\)?[\r\n|\n]$" ""
(shell-command-to-string (format "\"%s\" --version" ipython)))
evaluates to "8.12.0"
and as a result
(unless (version< version "5") " --simple-prompt")
evaluates to --simple-prompt
, what am I missing?
I read it wrong.
It should have --simple-prompt since ipython 5.
Could you try setting it to
"-i --simple-prompt --InteractiveShell.display_page=True"
(ref: https://www.emacswiki.org/emacs/PythonProgrammingInEmacs#h5o-41)
Right, so when I do that I get the __PYTHON_EL_eval
printouts again.
Removing --simple-prompt
solves the issue.
it does not make any sense
https://www.reddit.com/r/emacs/comments/12jexep/comment/jg5dyoq/
recently another person noted that adding --simple-prompt is needed to solve the exact problem.
please use git bisect to pin down the commit that introduced this issue.
https://github.com/syl20bnr/spacemacs/commits/develop/layers/%2Blang/python
here are commits that modified python layer.
it's advised by emacs upstream to set --simple-prompt.
It looks like the issue was related to also having to import readline
, and not to --simple-prompt
per se.
Closing. Thanks for the help.
@guibor @lebensterben hey guys, im running into exactly the same issue (Ipython 8.12.0).
I got lost tracking your conversations. So please what is the problem and solution?
Many thanks!
Description :octocat:
Every time I call
spacemacs/python-shell-send-region
I get weird printouts of__PYTHON_EL_eval
. I suppose this isn't directly related to spacemacs related but it is the outcome of the way the Python layer is set up.Would be happy to get any help.
System Info :computer: