I have the symptoms described here Input and Output does not show up in python mode, except this happens with python3 as interpreter as well as ipython, and I've tried the suggestions there for fixing ipython and have no improvement. show output from python-shell-send-region

With Ubuntu Linux, Emacs-25.2.2, the Python Inferior Shell does not show either the input nor the output I expect. I've tested with both python3 and ipython3, and I have the same symptom. Because I use R with Emacs-ESS, I had some expectation that Python with an inferior session would be similar, but, well, this seems to do nothing.

My init.el file has custom-set-variables so I use python3

(python-shell-interpreter "python3")

When I open a python code file, the Emacs status line says (Python) and to launch the interpreter, I either can use pull down menu Python -> Start Interpreter or M-x run-python. Either way, new buffer starts, looks like this:

In the python code buffer, I highlight some lines of code and use the pull down menu Python -> Eval Region. Emacs minibuffer says "Sent: import re ..." but, when using python3, the Inferior shell does not change at all. It displays neither input nor output.

I'll be specific. I'm using BeautifulSoup to read in an HTML file I saved. My Python region:

import re
from bs4 import BeautifulSoup

filename = "../workingdata/wp039-910.html"
soup = BeautifulSoup(open(filename, encoding='windows-1251'), "html.parser")

links = soup.find_all("a")


The Shell looks like this:

Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded

THat does not change when I highlight new code regions and run them, even if commands do trigger output

However, I can type a line into the shell and it shows the session did run those line.


I notice, however, that the history of the Python shell does not include the lines that were submitted by python mode, only the one I manually typed in.

What I want is for this to behave like Emacs-ESS, where the code I run fills in the output buffer, and the output also appears there.

When I change the shell to ipython3 with this insertion in the init file:

(setq python-shell-interpreter "ipython3"
   python-shell-interpreter-args "--simple-prompt --pprint")

The problem is slightly different. I can see the prompt incrementing in the shell when I send a region, but never see any input or output. Here I highlighted a block of lines and use pull down Python -> Eval Region, and I see the counter increments from 1 to 2:

Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: 
In [2]: 

And I can type commands there and it seems correct.

In [2]: links = soup.find_all("a")

In [3]: links[3]
<a class="a1" href="wp001e">English</a>

As it stands, this Inferior shell seems rather useless, if the only workable way to interact with it is to copy/paste from a py file at the prompt. I can't see any benefit in this and wonder if it is like this for everybody.

  • Apparently this solves it for some - github.com/jorgenschaefer/elpy/issues/924 - but causes separate issues for me. Oct 12, 2019 at 4:42
  • You might want to try lpy as a cool alternative github.com/abo-abo/lpy
    – guibor
    Oct 12, 2019 at 17:09
  • I have exactly the same problem, and found no solution. Can anyone tell if there is a way to fix this problem?
    – thibault
    Mar 12, 2020 at 12:11
  • I notice problem links to presence of pycache folder. Deleting that solved problem. I think failed session leaves the folder which has corrupt objects that emacs session is unable to cope.
    – pauljohn32
    Mar 16, 2020 at 2:38
  • Try adding -i to the list of arguments. ``` (setq python-shell-interpreter "ipython3" python-shell-interpreter-args "-i --simple-prompt --pprint") ``` Aug 5, 2021 at 16:05

1 Answer 1


I had a similar issue, to be more specific about the comments above:

1) For https://github.com/jorgenschaefer/elpy/issues/924 (suggested by thelatemail), I simply added the suggested block to (add-hook 'python-mode-hook ...)

2) The second option (lpy) prints evaluated sexps/lines in the minibuffer, and has other really nice features

  • The answer is unclear. Please do not reference comments - they can be deleted at any time. Instead, integrate the information into the answer. And even your #1 is not too clear: show the code changes you made.
    – Drew
    Oct 15, 2019 at 22:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.