From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Federico Beffa Newsgroups: gmane.emacs.bugs Subject: bug#18052: closed (Re: bug#18052: 24.3; python.el and ipython shell) Date: Sun, 20 Jul 2014 15:49:23 +0200 Message-ID: References: <878unoy3dt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1405864219 13593 80.91.229.3 (20 Jul 2014 13:50:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jul 2014 13:50:19 +0000 (UTC) To: 18052@debbugs.gnu.org, =?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 20 15:50:14 2014 Return-path: Envelope-to: geb-bug-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 1X8rVF-0004AJ-S4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Jul 2014 15:50:14 +0200 Original-Received: from localhost ([::1]:57808 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8rVF-0000AC-JG for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Jul 2014 09:50:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8rV9-00006Y-3p for bug-gnu-emacs@gnu.org; Sun, 20 Jul 2014 09:50:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8rV5-0004BA-30 for bug-gnu-emacs@gnu.org; Sun, 20 Jul 2014 09:50:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8rV4-0004Ay-Va for bug-gnu-emacs@gnu.org; Sun, 20 Jul 2014 09:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X8rV4-0003it-DO for bug-gnu-emacs@gnu.org; Sun, 20 Jul 2014 09:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Federico Beffa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Jul 2014 13:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18052 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 18052-submit@debbugs.gnu.org id=B18052.140586417414271 (code B ref 18052); Sun, 20 Jul 2014 13:50:02 +0000 Original-Received: (at 18052) by debbugs.gnu.org; 20 Jul 2014 13:49:34 +0000 Original-Received: from localhost ([127.0.0.1]:60086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X8rUb-0003i6-MX for submit@debbugs.gnu.org; Sun, 20 Jul 2014 09:49:34 -0400 Original-Received: from mail-la0-f45.google.com ([209.85.215.45]:35136) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X8rUY-0003hp-EG for 18052@debbugs.gnu.org; Sun, 20 Jul 2014 09:49:31 -0400 Original-Received: by mail-la0-f45.google.com with SMTP id ty20so4084214lab.32 for <18052@debbugs.gnu.org>; Sun, 20 Jul 2014 06:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=JxiPatnfbbz72gxhctRWV1ulpoSeoiPQR6+T9R7z32Y=; b=VdR5bIU2KraO1lXCAOs4gcsLK1Su+oYoN+AJ8Xg0XfJZ4HIfcussrWICqRDd5ls5l7 T6Xer+S1qhij0/vHaFkxZrFl7NhvH9c9gnY+6qbVWhw+peHiQTUNA9qBxNWiBV2Lki6T rV4jRoIfYjwdyxOdOQnq4rCYpS7HPZF/SJgoJ1R+hnM7cXxu3KnAp13BzlFEctZLeIwq NTIQ+rMIe+2PO9oDD1zDJ1Yuwf+oPPHcihJncAxPE9UzcCNw2lgMe/VEl28sbUZJPcct pPj7iDlsi5dcgUhwLSwelnWkipVtJZ7JhOlZY9uXMCKCat2kgeqz8xSNiXp40vCwuFrB 7o4Q== X-Received: by 10.112.13.4 with SMTP id d4mr18185232lbc.50.1405864163845; Sun, 20 Jul 2014 06:49:23 -0700 (PDT) Original-Received: by 10.114.18.44 with HTTP; Sun, 20 Jul 2014 06:49:23 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: NsOzF7J4Y_pWEMo7LJGKe7BUlxo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91701 Archived-At: I can confirm that removing "console" resolves the problem. Thank you very much for the help! Best Regards, Fede On Sun, Jul 20, 2014 at 8:03 AM, GNU bug Tracking System wrote: > Your bug report > > #18052: 24.3; python.el and ipython shell > > which was filed against the emacs package, has been closed. > > The explanation is attached below, along with your original report. > If you require more details, please reply to 18052@debbugs.gnu.org. > > -- > 18052: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18052 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems > > > ---------- Forwarded message ---------- > From: fgallina@gnu.org (Fabi=C3=A1n Ezequiel Gallina) > To: Federico Beffa > Cc: 18052-done@debbugs.gnu.org > Date: Sun, 20 Jul 2014 03:02:06 -0300 > Subject: Re: bug#18052: 24.3; python.el and ipython shell > Federico Beffa writes: > >> Unfortunately it does not. I see the same intermittent problem as >> without the "-u" option. >> > > So I tracked down what's going on. Removing "console" from your > `python-shell-interpreter-args' should do the trick. > > The "console" subcommand, starts an iPython server (AKA kernel) and then > connects the client console to it (that's the reason you see two > processes). Removing the "console" subcommand just starts a standalone > iPython shell that doesn't suffer from this intermittent initialization > problem. > > Now the reason why the console subcommand fails seems to be an iPython > bug itself. What happens is that python.el shell setup codes are sent > quickly as soon as the inferior process starts, but it seems that > sometimes the iPython kernel startup doesn't expect that and fails to > start properly, thus causing the resulting iPython shell to be non > responsive. > > This is not particularly a problem of python.el, in fact the issue can > be replicated in the commandline by spawning processes like so: > > echo "print ('yes')" | ipython console > > With that, I get the same intermittent behavior observed previously. So > my suggestion is to report this bug upstream. > > In the meantime, I'll include some notes about this in the header of > python.el. > > > PS: As you may expect, when an iPython kernel is already started, using > "console --existing" works reliably, this may be useful in case you > really needed the client-server mode. > > > > Cheers, > Fabi=C3=A1n > > > > ---------- Forwarded message ---------- > From: Federico Beffa > To: bug-gnu-emacs@gnu.org > Cc: > Date: Fri, 18 Jul 2014 15:51:47 +0200 > Subject: 24.3; python.el and ipython shell > I'm trying to use the ipython shell from within emacs. To do so I've > followed the instructions at the top of python.el and added the > following code to my .emacs: > > (setq > python-shell-interpreter "C:/Anaconda/python.exe" > python-shell-interpreter-args > "-i C:/Anaconda/Scripts/ipython-script.py console --matplotlib=3Dqt" > python-shell-prompt-regexp "In \\[[0-9]+\\]: " > python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: " > python-shell-completion-setup-code > "from IPython.core.completerlib import module_completion" > python-shell-completion-module-string-code > "';'.join(module_completion('''%s'''))\n" > python-shell-completion-string-code > "';'.join(get_ipython().Completer.all_completions('''%s'''))\n") > > When I execute (M-x) run-python, SOMETIMES the session does not > initialize properly and the new buffer looks like this: > > ----------------------------------------------------------- > Python 2.7.6 |Anaconda 2.0.1 (64-bit)| (default, Nov 11 2013, > 10:49:15) [MSC v.1500 64 bit (AMD64)] > Type "copyright", "credits" or "license" for more information. > > IPython 2.1.0 -- An enhanced Interactive Python. > Anaconda is brought to you by Continuum Analytics. > Please check out: http://continuum.io/thanks and https://binstar.org > ? -> 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]: > ----------------------------------------------------------- > > The difference compared to the situation when everything is well, is > that here I only see "In [1]:", while normally I should see 4 empty > input prompts, with the last one reading "In [4]". When I execute any > command such as "1+1" and press RET, nothing happens. > > This happens starting emacs with the -Q option and executing the ipython > customization in the *scratch* buffer. > > By running the debugger I've found out that emacs sends some commands to > the inferior python shell with (comint-send-string ...) and tries to > hide them from the user. That appears to be the reason for the four > empty prompts. > > Looking at the running processes I've noted that there are 2 python > processes running. The task manager reports one as: > c:\Anaconda\python.exe -c"from IPython.kernel.zmq.kernelapp import main; > main()" -f > C:\Users\beffa\.ipython\profile_default\security\kernel-976.json > --matplotlib=3Dqt --IPKernelApp.parent_appname=3D'ipython-console' > --interrupt=3D692 --parent=3D696 > > (Obviously the value of the last two arguments change everytime.) > If I kill this process, the inferior python shell asks: > > "kernel died, restart ([y]/n)? kernel died, restart ([y]/n)? kernel > died, restart ([y]/n)?" > > If I press y the process is restarted and the inferior python shell > works fine (or at least responds to the commands like 1+1 that I've > tried). > > I would greatly appreciate any suggestion on how to further dig into > debugging and solve this intermittent problem. > > Thank you in advance for your help. > Fede > > > In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601) > of 2013-03-17 on MARVIN > Windowing system distributor `Microsoft Corp.', version 6.1.7601 > Configured using: > `configure --with-gcc (4.7) --cflags > -ID:/devel/emacs/libs/libXpm-3.5.8/include > -ID:/devel/emacs/libs/libXpm-3.5.8/src > -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include > -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include > -ID:/devel/emacs/libs/giflib-4.1.4-1/include > -ID:/devel/emacs/libs/jpeg-6b-4/include > -ID:/devel/emacs/libs/tiff-3.8.2-1/include > -ID:/devel/emacs/libs/gnutls-3.0.9/include > -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include > -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2' > > Important settings: > value of $LANG: ENU > locale-coding-system: cp1252 > default enable-multibyte-characters: t > > Major mode: Lisp Interaction > > Minor modes in effect: > show-paren-mode: t > tooltip-mode: t > mouse-wheel-mode: t > tool-bar-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > blink-cursor-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > line-number-mode: t > transient-mark-mode: t > > Recent input: > C-x C-r C-SPC C-a C-w c : / p r o > SPC SPC e m 3 s i s i > d f > > > > > C-SPC > > M-w C-x b > C-y M-x s h o w - p a C-x C-e M-x r > u n - p y C-x k y e s > C-x 0 M-x r u n - p y > C-x o M-x r e p o r n> > > Recent messages: > "';'.join(get_ipython().Completer.all_completions('''%s''')) > " > Sent python-shell-completion-setup-code > Sent python-ffap-setup-code > Sent python-eldoc-setup-code > Making completion list... > Sent python-shell-completion-setup-code > Sent python-ffap-setup-code > Sent python-eldoc-setup-code > Making completion list... > > Load-path shadows: > None found. > > Features: > (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml > mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev > gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util > mail-prsvr mail-utils help-mode compile python rx easymenu comint ring > ansi-color cus-start cus-load paren time-date tooltip ediff-hook > vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns > disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe > tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow > timer select scroll-bar mouse jit-lock font-lock syntax facemenu > font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan > thai tai-viet lao korean japanese hebrew greek romanian slovak czech > european ethiopic indian cyrillic chinese case-table epa-hook > jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces > cus-face macroexp files text-properties overlay sha1 md5 base64 format > env code-pages mule custom widget hashtable-print-readable backquote > make-network-process w32 multi-tty emacs) > > >