From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Multiple prompts when starting inferior Python Date: Tue, 06 May 2014 18:29:03 +0200 Message-ID: <53690DCF.1050105@easy-emacs.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1399413693 23382 80.91.229.3 (6 May 2014 22:01:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 May 2014 22:01:33 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 07 00:01:28 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WhnPT-00015O-Hx for geh-help-gnu-emacs@m.gmane.org; Wed, 07 May 2014 00:00:23 +0200 Original-Received: from localhost ([::1]:36352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhiFH-0004kK-Iq for geh-help-gnu-emacs@m.gmane.org; Tue, 06 May 2014 12:29:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhiF1-0004ij-48 for help-gnu-emacs@gnu.org; Tue, 06 May 2014 12:29:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhiEv-0007i8-OW for help-gnu-emacs@gnu.org; Tue, 06 May 2014 12:29:15 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:57533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhiEv-0007hN-GH for help-gnu-emacs@gnu.org; Tue, 06 May 2014 12:29:09 -0400 Original-Received: from [192.168.178.32] (brln-4dba2221.pool.mediaWays.net [77.186.34.33]) by mrelayeu.kundenserver.de (node=mreue007) with ESMTP (Nemesis) id 0MQYgq-1WGIwB0Zae-00To4U; Tue, 06 May 2014 18:29:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Icedove/24.4.0 In-Reply-To: X-Provags-ID: V02:K0:lLGFkdmaFPK6uTD067QI5PE6TI583DpqUM9n14KSzRF 9BVDwP+UaSbibay+MEiQY/TPnYgBwKb5WgHZN+PCp0liwJggTa YISXvo4t/q6rU7rS0VHV7XV9qtdZbP2V9hlO1wfFkjjJLT3o+R Yyz1+10j1tjkUpaOV8lxpGYA7NVAN65ruALHn79ovCbKuBJTcz fCE6kbklQBbbrTcvPKgKEO9JdNUA6IF8BUgbAk9C9wmekF/LWD e8resI9RVTI9wMyhXAAWc6XobUshPq2yZo/nUgjNvZgobOY8Rz mU0CFvl2/b6y9tUf1oNwF3VEBYNkmQJBoWrKLLlowDKPnQ3wwl WODM+zQOPjDRJhBpJ+8szm/475HL5v3MmRtim/l0c X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.126.130 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97564 Archived-At: On 06.05.2014 18:17, Joost Kremers wrote: > Hi, > > Whenever I start an interactive Python session in Emacs, I get four > empty prompts instead of one. That is, when I do `M-x run-python' (or > start from a Python file with `C-c C-z'), the *Python* buffer looks like > this: > > ,---- > | Python 2.7.3 (default, Feb 27 2014, 19:58:35) > | Type "copyright", "credits" or "license" for more information. > | > | IPython 0.12.1 -- 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. > | > | In [1]: > | In [2]: > | In [3]: > | In [4]: > | > `---- > > I use elpy and IPython, but that doesn't make a difference. This is what > I get when running an interactive Python shell with `emacs -Q': > > ,---- > | Python 2.7.3 (default, Feb 27 2014, 19:58:35) > | [GCC 4.6.3] on linux2 > | Type "help", "copyright", "credits" or "license" for more information. > | >>> >>> >>> >>> > `---- > > Note the four `>>>'. > > This is something that's been happening a while, and it's never really > bothered me. However, the other day someone on Reddit asked the same > question,[1] which prompted me to do some digging. I ran `run-python' > though the debugger and it seems that those prompts are caused by the > function `python-shell-send-setup-code', which sends the contents of the > variables listed in the variable `python-shell-setup-codes' to the > inferior python process when it's started. The default value of this > option is: > > ,---- > | (python-shell-completion-setup-code python-ffap-setup-code python-eldoc-setup-code) > `---- > > Each of these variables contains some code which, when sent to the > inferior python process, results in a new prompt being displayed, even > though the actual command is not shown. > > Is this something that should be considered a bug? Can it be avoided > somehow or should I simply live with it? (Which isn't very difficult, it > doesn't seem to affect anything.) > > TIA > > > [1] http://www.reddit.com/r/emacs/comments/24fy1q/help_get_rid_of_multiple_inputs_when_running_a/ > > That's because some some setup-code is sent to the python-process connected to the buffer. Basically a filter could wipe them out. OTOH it's does no harm. With python-mode.el and M-x python RET you should not have this. BTW with ipython, you will see the prompt-counter raised and starting with [5] or so - for the very same reason.