0

This looks like Weird shell output when using IPython 5, but it actually is not. I did set

(setq python-shell-interpreter-args "--simple-prompt -i --pylab")

in .emacs, but I get the following error:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
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.
Using matplotlib backend: TkAgg
Warning: disable autoreload in ipython_config.py to improve performance.

In [1]: 
In [2]: 
In [3]: 
In [4]: for i in range(3):
File "<ipython-input-4-658181e351fb>", line 1
for i in range(3):
                   ^
SyntaxError: unexpected EOF while parsing

This appears after I hit return. I was expecting the interpreter to wait for the content of the loop. Note that if I do not set the python-shell-interpreter-args, the prompt is garbage, but there is no error.

gdupret
  • 3
  • 2
  • Which environment do you use. For me, with python 2.7.9/ipython 2.3.0/Emacs 24.4.1 (and 25.1.1) on recent GNU/linuxen there are no problems with either python nor ipython in both `run-python` (with `C-u M-x run-python` to select python or ipython) and shell mode. – Vera Johanna Dec 01 '16 at 10:51
  • Try: `for i in arange(3)` – Ian Dec 01 '16 at 14:29
  • Hi @pingi, I run GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian; The python, ipython version numbers are in the question above. I tried using C-u M-x run-python, but it generates the same error. – gdupret Dec 01 '16 at 18:10
  • Hi @Ian, this was a typo in the question, now corrected. The error is the same with range(3) and arange(3) – gdupret Dec 01 '16 at 18:16

2 Answers2

1

This issue was brought up to the ipython team. It sounds unlikely that there will be progress from that side.

One option they suggest is reinstalling ipython 4.x (for instance in an Anaconda prompt pip install --force-reinstall ipython==4.2.1. If like me, ipython 4.x doesn't work at all, you can reinstall the latest version with pip install --upgrade --ignore-installed ipython, as described here)

Another option they brought up is using EIN, which is probably overkill, but it seems to be the best option to me.

Topher
  • 26
  • 2
0

I get the same error with Emacs 25.1.1. Python 3.5.2 and ipython 5 changed things quite a bit and Emacs has not caught up yet. I would file an Emacs bug report.

FYI: Use of the pylab import is now discouraged and and the OO interface is recommended for most non-interactive usage

And --pylab now deprecated from notebooks. I would create a jupiter profile and use plt. and np. conventions.

This is what I use:

     (setq python-shell-interpreter-args "--simple-prompt --pprint")
eflanigan00
  • 785
  • 4
  • 11