ipython3 not interacting with emacs properly

Asked by Travis N. Knepp

Before filing a bug report, I first want to make sure this is a bug.

emacs version: 25.1.1
elpy version 1.13
Python version 3.5
OS: RHEL6

Copied from http://emacs.stackexchange.com/questions/29811/lisp-error-with-elpy-under-python-3

I've had my emacs (v. 25.1.1) working with elpy (1.13) under Python 2.7 for a while. I decided to switch to Python 3 recently,
and cannot get it to interact with emacs properly. Normally, when I want to run a script in emacs I C-c C-c, which opens an ipython interpreter. Since switching to Python3, the ipython interpreter still opens, but with problems.

1. I get the following backtrace error:

.

    Debugger entered--Lisp error: (args-out-of-range "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)
    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.

    [6n[0m
    [0m[J
    " 427)
      string-match("" "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[6n[0m
    [0m[J
    " 427)
      ansi-color-filter-apply("Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
    [0m[J
    [?12l[?25h")
      python-shell-comint-watch-for-first-prompt-output-filter("Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
    [0m[J
    [?12l[?25h")
      run-hook-with-args(python-shell-comint-watch-for-first-prompt-output-filter "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
    [0m[J
    [?12l[?25h")
      comint-output-filter(#<process Python> "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n? -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp -> Python's own help system.\nobject? -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
    [0m[J
    [?12l[?25h")

2. The ipython interpreter looks "funky" as well. Normally, line numbers would show up as:

.

    In [1]: 7/9

    Out [1]: 0.77777777777777778

    In [2]:

However, I get something like this:

    [6n[JIn [2]: [8D[8C7/9

    [8D[JIn [2]: 7/9[11D

    [JOut[2]: 0.7777777777777778

    [6n[JIn [3]: [8D[8C

For the life of me I cannot figure out why the ipython interpreter is so hosed. Any help will be appreciated.

As you can see from the copied text above, the ipython interpreter is not interacting with emacs very well at all. ChillarAnand had suggested this to be a python-mode bug. What do you think?

Question information

Language:
English Edit question
Status:
Answered
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andreas Roehler (a-roehler) said :
#1

Thanks reporting. The python-mode shown is from python.el, not from python-mode.el developed here. Nonetheless, detected a related bug. Will fix it ASAP. BTW, sure you need IPython? From Emacs plain Python(s) in general are faster.

Revision history for this message
Travis N. Knepp (tnknepp) said :
#2

Andreas,

     Thanks for the update.

     I have to admit I am pretty new to using Python within emacs
(normally used Spyder), so I have been using ipython to allow
interaction. I just ran a dummy script with Python as the interpreter
and it worked with no problems (though having IPython features would be
nice). Thanks for the tip.

     I was under the impression I needed to run both python-mode and
elpy, is that correct? Can I just run one? Would that simplify things?

             Travis

On 01/06/2017 12:17 PM, Andreas Roehler wrote:
> Your question #431356 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/431356
>
> Status: Open => Answered
>
> Andreas Roehler proposed the following answer:
> Thanks reporting. The python-mode shown is from python.el, not from
> python-mode.el developed here. Nonetheless, detected a related bug. Will
> fix it ASAP. BTW, sure you need IPython? From Emacs plain Python(s) in
> general are faster.
>

--

Travis N. Knepp

Lead Research Scientist

SAGE-III on ISS <http://sage.nasa.gov/>CAPABLE Air Quality Station
<http://capable.larc.nasa.gov/>

<email address hidden> <mailto:<email address hidden>>

Mail Stop 401A, B1250, Room 149
Hampton, VA 23681-2199

757-864-5558

Science Systems and Applications, Inc. (SSAI)

/Science and Technology with Passion/

10210 Greenbelt Road, Suite 600

Lanham, MD 20706

www.ssaihq.com <http://www.ssaihq.com/>

Please be mindful about forwarding this e-mail; it may contain
confidential information that is not intended for anyone else. Thank you.

Revision history for this message
Andreas Roehler (a-roehler) said :
#3

Can you help with this problem?

Provide an answer of your own, or ask Travis N. Knepp for more information if necessary.

To post a message you must log in.