[IPython-User] IPython Qt Console hangs when I use raw_input() in a loop

Fernando Perez fperez.net@gmail....
Wed Feb 1 22:27:04 CST 2012


On Tue, Jan 31, 2012 at 12:46 PM, Alejandro Weinstein
<alejandro.weinstein@gmail.com> wrote:
> My IPython Qt Console hangs when I use raw_input() in a loop. I need
> to Ctrl-C to break the loop. It hangs in different in a different part
> of the loop each time I run the code. The same code works as expected
> in a terminal instance of IPython. The following snippet illustrates
> the problem. I am running Python 2.7.2, IPython 0.12 in an Ubuntu
> 11.10 machine.
>
> #######################################
> In [1]: d = dict((x,x**2) for x in range(100))
>
> In [2]: for e in d:
>   ...:     print e,d[e]
>   ...:     raw_input()


Just to confirm that I was able to reproduce this on master. Oddly,
when it hangs, if I wait long enough it seems to wake up again, at
least in my few tries.   I don't know if that gives Min a clue as to
what may be going on, as I suspect it's an issue with how we're using
the zmq sockets to 'forward' raw_input from the kernel to the client.

Cheers,

f


More information about the IPython-User mailing list