Subject: bug#18052: 24.3; python.el and ipython shell

From: Eli Zaretskii <[email-masked]>
Date: Fri, 18 Jul 2014 17:07:21 +0300

> Date: Fri, 18 Jul 2014 15:51:47 +0200
> From: Federico Beffa <[email-masked]>
> 
> 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=qt"
>  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.

Did you try to explore the possibility that this is caused by
buffering?  Pipes on Windows are fully buffered, not line-buffered as
on Posix systems.  If there's some way to control buffering from the
Python side, I suggest to try that, perhaps it will fix the problem.