From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jaan Altosaar Newsgroups: gmane.emacs.bugs Subject: bug#32042: 26.1; python.el with ipython prompt leads to superfluous interactive shell output Date: Mon, 2 Jul 2018 16:13:14 -0400 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f68564057009d3de" X-Trace: blaine.gmane.org 1530562991 586 195.159.176.226 (2 Jul 2018 20:23:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Jul 2018 20:23:11 +0000 (UTC) To: 32042@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 02 22:23:07 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fa5Lm-0008RA-7K for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2018 22:23:06 +0200 Original-Received: from localhost ([::1]:35290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa5Nr-0005cR-PA for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Jul 2018 16:25:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa5Nj-0005Zv-3H for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:25:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa5Ne-0001RO-Tv for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:25:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa5Ne-0001RF-Pp for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fa5Ne-00072p-Dw for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jaan Altosaar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Jul 2018 20:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32042 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153056305127013 (code B ref -1); Mon, 02 Jul 2018 20:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jul 2018 20:24:11 +0000 Original-Received: from localhost ([127.0.0.1]:43957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fa5Mo-00071d-Iw for submit@debbugs.gnu.org; Mon, 02 Jul 2018 16:24:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fa5Cc-0006lK-PG for submit@debbugs.gnu.org; Mon, 02 Jul 2018 16:13:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa5CV-0000qp-NO for submit@debbugs.gnu.org; Mon, 02 Jul 2018 16:13:33 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fa5CV-0000qg-Ij for submit@debbugs.gnu.org; Mon, 02 Jul 2018 16:13:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa5CT-0002S7-82 for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:13:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa5CO-0000oE-1A for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:13:29 -0400 Original-Received: from ppa03.princeton.edu ([128.112.128.214]:57922 helo=Princeton.EDU) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fa5CN-0000nx-RG for bug-gnu-emacs@gnu.org; Mon, 02 Jul 2018 16:13:23 -0400 Original-Received: from csgsmtp203l.Princeton.EDU (csgsmtp203l.Princeton.EDU [140.180.223.156]) by ppa03.princeton.edu (8.16.0.21/8.16.0.21) with ESMTPS id w62KDMLw027607 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 2 Jul 2018 16:13:22 -0400 Original-Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) (authenticated authid=altosaar bits=0) by csgsmtp203l.Princeton.EDU (8.14.4/8.12.9) with ESMTP id w62KDGnq032531 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 2 Jul 2018 16:13:22 -0400 Original-Received: by mail-it0-f48.google.com with SMTP id p17-v6so46683itc.2 for ; Mon, 02 Jul 2018 13:13:22 -0700 (PDT) X-Gm-Message-State: APt69E0bAoaCw8SwhQMBK/9rKlGeUvBhokbFjBs9oTb35m6nHdKLgmoQ N6R/h9PFAe1w69qeOK9dhus3g1w57TQuDUq4xLc= X-Google-Smtp-Source: AAOMgpfuBZVVB26yycLKELejF4FqDShhM3xE0js12JO1sCs3QfYMObvqpXSmmCt869Qkaw7SA2yJqoxq9bWYiocumOM= X-Received: by 2002:a02:3d58:: with SMTP id n85-v6mr21158601jan.99.1530562396714; Mon, 02 Jul 2018 13:13:16 -0700 (PDT) Original-Received: by 2002:a6b:7416:0:0:0:0:0 with HTTP; Mon, 2 Jul 2018 13:13:14 -0700 (PDT) X-Gmail-Original-Message-ID: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-02_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=quarantine_notspam policy=quarantine score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807020225 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Mon, 02 Jul 2018 16:24:09 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:148124 Archived-At: --000000000000f68564057009d3de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/interactives= hell.py", line 2963, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in import codecs, os;__pyfile =3D codecs.open('''/var/folders/qr/s_h2rhqj6kdg8qrj0zw2scnw0000gn/T/pyLbk6Vh'''= , encoding=3D'''utf-8''');__code =3D __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/fold= ers/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 =E2=80=98test.py=E2=80=99.... [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 =E2=80=98M-x run-python=E2=80= =99 or =E2=80=98C-c C-p=E2=80=99. 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=3D/usr/local/share/emacs/site-lisp --infodir=3D/usr/local/Cellar/emacs/26.1_1/share/info/emacs --prefix=3D/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)) --000000000000f68564057009d3de Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here is how I'm starting emacs, with these contents of init.el:
```
(setq
=C2=A0python-shell-interpreter "= ipython"
=C2=A0python-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)<= /div>
```

And run it using `M-x run-python` th= en `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):

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

<= div>=C2=A0 File "<ipython-input-1-57ce0cd600e5>", line 1, i= n <module>
=C2=A0 =C2=A0 import codecs, os;__pyfile =3D cod= ecs.open('''/var/folders/qr/s_h2rhqj6kdg8qrj0zw2scnw0000gn/T/py= Lbk6Vh''', encoding=3D'''utf-8''');__co= de =3D
__pyfile.read().encode('''utf-8'''= );__pyfile.close();os.remove('''/var/folders/qr/s_h2rhqj6kdg8qr= j0zw2scnw0000gn/T/pyLbk6Vh''');exec(compile(__code, ''&= #39;/Users/jaan/tmp/test.py''', 'exec'));
=C2=A0 File "/Users/jaan/tmp/test.py", line 2
=C2=A0 =C2=A0 print('test bug)
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^
SyntaxError: EOL whi= le scanning string literal
```

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

Thanks so much! Emacs ne= wbie here, may be missing something basic...


<= /div>
In GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.5.0)
= =C2=A0of 2018-06-02 built on 172-16-42-187.DYNAPOOL.NYU.EDU
Recent messages:
Searching for =E2=80=98test.py=E2=80=99.... [2 times]
(New file)=
Saving file /Users/jaan/tmp/test.py...
Wrote /Users/ja= an/tmp/test.py
user-error: Start a Python process first with =E2= =80=98M-x run-python=E2=80=99 or =E2=80=98C-c C-p=E2=80=99.
Shell= native completion is disabled, using fallback
Sent: print('t= est printing')...
Mark set
Quit
user-erro= r: Current buffer has no process
Quit
Configured using:=
=C2=A0'configure --disable-dependency-tracking --disable-sil= ent-rules
=C2=A0--enable-locallisppath=3D/usr/local/share/emacs/s= ite-lisp
=C2=A0--infodir=3D/usr/local/Cellar/emacs/26.1_1/share/i= nfo/emacs
=C2=A0--prefix=3D/usr/local/Cellar/emacs/26.1_1 --with-= gnutls --without-x
=C2=A0--with-xml2 --without-dbus --with-imagem= agick --with-rsvg --without-ns'

Configured fea= tures:
JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB THREADS LCMS2

Important settings:
=C2=A0 value of $LC_ALL: en_= US.UTF-8
=C2=A0 value of $LC_CTYPE: en_US.UTF-8
=C2=A0 = value of $LANG: en_US.UTF-8
=C2=A0 locale-coding-system: utf-8-un= ix

Major mode: Inferior Python

Minor modes in effect:
=C2=A0 compilation-shell-minor-mode:= t
=C2=A0 shell-dirtrack-mode: t
=C2=A0 diff-auto-refin= e-mode: t
=C2=A0 helm-mode: t
=C2=A0 async-bytecomp-pac= kage-mode: t
=C2=A0 xclip-mode: t
=C2=A0 ido-everywhere= : t
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t<= /div>
=C2=A0 electric-indent-mode: t
=C2=A0 file-name-shadow-= mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-loc= k-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-e= ncryption-mode: t
=C2=A0 auto-compression-mode: t
=C2= =A0 line-number-mode: t
=C2=A0 global-visual-line-mode: 1
=C2=A0 visual-line-mode: t
=C2=A0 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-par= se rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc20= 45 ietf-drums mm-util mail-prsvr
mail-utils ffap compile python t= ramp-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-c= ommand helm-elisp helm-eval edebug helm-info
ring info tool-bar m= isearch multi-isearch term/xterm xterm time-date
elec-pair helm-m= ode helm-files helm-buffers helm-tags helm-locate
helm-grep helm-= regexp format-spec helm-utils helm-help helm-types helm
easy-mmod= e helm-source eieio-compat helm-multi-match helm-lib
helm-config = helm-easymenu async-bytecomp advice async xclip edmacro
kmacro so= larized-theme solarized-definitions ido finder-inf package
easyme= nu epg-config url-handlers url-parse auth-source cl-seq eieio
eie= io-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<= /div>
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan = thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek r= omanian
slovak czech european ethiopic indian cyrillic chinese co= mposite
charscript charprop case-table epa-hook jka-cmpr-hook hel= p 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-pr= int-readable backquote kqueue
lcms2 multi-tty make-network-proces= s emacs)

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

--000000000000f68564057009d3de--