Subject: 26.1; python.el with ipython prompt leads to superfluous interactive shell output

From: Jaan Altosaar <[email-masked]>
Date: Mon, 2 Jul 2018 16:13:14 -0400

Here is how I'm starting emacs, with these contents of init.el:
```
(setq
 python-shell-interpreter "ipython"
 python-shell-interpreter-args "--simple-prompt --classic --nosep"
)
```
Then if I open a file `~/tmp/test.py` with the contents:

```
print('test printing')
print('test bug)
```

And run it using `M-x run-python` then `M-x python-shell-send-buffer`,
the output is quite messy:

```
Python 3.6.5 |Anaconda custom (64-bit)| (default, Apr 26 2018, 08:42:37)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
>>> Traceback (most recent call last):

  File
"/usr/local/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py",
line 2963, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-1-57ce0cd600e5>", line 1, in <module>
    import codecs, os;__pyfile =
codecs.open('''/var/folders/qr/s_h2rhqj6kdg8qrj0zw2scnw0000gn/T/pyLbk6Vh''',
encoding='''utf-8''');__code =
__pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/qr/s_h2rhqj6kdg8qrj0zw2scnw0000gn/T/pyLbk6Vh''');exec(compile(__code,
'''/Users/jaan/tmp/test.py''', 'exec'));

  File "/Users/jaan/tmp/test.py", line 2
    print('test bug)
                    ^
SyntaxError: EOL while scanning string literal
```

Is there any way to clean up the output, especially the parts involving
`codecs.open('''/var/folders/qr/s_h2rhqj6kdg8qrj0zw2scnw0000gn/T/pyLbk6Vh'''`?

Thanks so much! Emacs newbie here, may be missing something basic...

In GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.5.0)
 of 2018-06-02 built on 172-16-42-187.DYNAPOOL.NYU.EDU
Recent messages:
Searching for ‘test.py’.... [2 times]
(New file)
Saving file /Users/jaan/tmp/test.py...
Wrote /Users/jaan/tmp/test.py
user-error: Start a Python process first with ‘M-x run-python’ or ‘C-c C-p’.
Shell native completion is disabled, using fallback
Sent: print('test printing')...
Mark set
Quit
user-error: Current buffer has no process
Quit
Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/26.1_1/share/info/emacs
 --prefix=/usr/local/Cellar/emacs/26.1_1 --with-gnutls --without-x
 --with-xml2 --without-dbus --with-imagemagick --with-rsvg --without-ns'

Configured features:
JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB THREADS LCMS2

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Inferior Python

Minor modes in effect:
  compilation-shell-minor-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  helm-mode: t
  async-bytecomp-package-mode: t
  xclip-mode: t
  ido-everywhere: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  global-visual-line-mode: 1
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils ffap compile python tramp-sh tramp tramp-compat
tramp-loaddefs trampver ucs-normalize shell pcomplete parse-time json
map comint regexp-opt ansi-color vc-git diff-mode image winner thingatpt
cl-extra help-mode helm-command helm-elisp helm-eval edebug helm-info
ring info tool-bar misearch multi-isearch term/xterm xterm time-date
elec-pair helm-mode helm-files helm-buffers helm-tags helm-locate
helm-grep helm-regexp format-spec helm-utils helm-help helm-types helm
easy-mmode helm-source eieio-compat helm-multi-match helm-lib
helm-config helm-easymenu async-bytecomp advice async xclip edmacro
kmacro solarized-theme solarized-definitions ido finder-inf package
easymenu epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt
gv bytecomp byte-compile cconv cl-loaddefs cl-lib mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese composite
charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote kqueue
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 405604 13728)
 (symbols 48 31824 1)
 (miscs 40 176 376)
 (strings 32 78802 1488)
 (string-bytes 1 2336041)
 (vectors 16 50728)
 (vector-slots 8 892846 8650)
 (floats 8 126 1059)
 (intervals 56 4765 66)
 (buffers 992 20))