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
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") type(links) type(links)
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 : In :
And I can type commands there and it seems correct.
In : links = soup.find_all("a") In : links Out: <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.