Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython in emacs dumps trash text into shell

Tags:

emacs

ipython

When I launch an ipython process in an emacs buffer, it prints trash text to the buffer:

^[[J^[[?7h^[[?12l^[[?25h^[[?2004l
^[[?12l^[[?25h

The ipython buffer does this every time I launch it, every time I evaluate code in another buffer, every time I evaluate code in that buffer. Ipython never does this from the bash CLI, In [1]:

Where could I look to change this behavior to a more sensible and terse prompt, such as what ipython does in bash?

This is in emacs 24.5.1 inside tmux 2.0 with python 2.7.6, ipython 5.1.0, python-mode version 6.2.1, running on Ubuntu 14.04 LTS.

Here's every line in my .emacs file that even mentions python:

; (require 'python-settings)

; (require 'ein)

(setq py-install-directory "~/.emacs.d/python-mode")

(add-to-list 'load-path py-install-directory)

(require 'python-mode)

(setq python-shell-interpreter "~/anaconda2/bin/python"
      python-shell-interpreter-args "-i console --matplotlib")

(setq-default py-shell-name "ipython")

(setq-default py-which-bufname "IPython")

; use the wx backend, for both mayavi and matplotlib
(setq py-python-command-args
  '("--gui=wx" "--pylab=wx" "-colors" "Linux"))

;; responsible for the annoying window rearrangement behavior after every code execution? Nope.

(setq py-force-py-shell-name-p t)

; switch to the interpreter after executing code

(setq py-shell-switch-buffers-on-execute-p nil)

(setq py-switch-buffers-on-execute-p nil)

(setq py-shell-local-path "/home/ftamborello/anaconda2/bin/python"
      py-use-local-default t)

; don't split windows

(setq py-split-window-on-execute-p nil)


; try to automagically figure out indentation

(setq py-smart-indentation t)

; enable flycheck syntax support

; (add-hook 'after-init-hook #'global-flycheck-mode)
like image 351
fpt Avatar asked Dec 07 '25 03:12

fpt


1 Answers

what Thomas K suggests is the actual solution, just edit your init.el file and paste the following:

RUN IPYTHON6.4 IN EMACS ALONG WITH PYTHON3+
(setq python-shell-interpreter "ipython3"
      python-shell-interpreter-args "-i --simple-prompt")
like image 132
nafnaf Avatar answered Dec 08 '25 23:12

nafnaf