[IPython-User] Using embedded IPython with gevent

MinRK benjaminrk@gmail....
Wed Oct 26 11:12:44 CDT 2011


As I understand it gevent is about pseudo-threads, not threads, so you have
to be running the gevent eventloop.  Greenlets do not run in the
background.

That would mean that you have to integrate IPython with the greenlet
eventloop, as we do currently with various GUI eventloops via code in
IPython.lib.inputhook.

I find replacing IPython.embed() with time.sleep(10), which is perfectly
equivalent as far as the greenlets are concerned, also prevents the greenlet
from ever
firing, so I presume there is some eventloop that must be called.

-MinRK

On Wed, Oct 26, 2011 at 08:47, Thomas Kluyver <takowl@gmail.com> wrote:

> On 26 October 2011 16:27, Dave Foster <dave.foster@gmail.com> wrote:
>
>> No, no errors, IPython seems to be running just fine. What I'm missing
>> is the "worker" greenlet actually running. I was hoping that while I'm
>> in the shell, it would still run the greenlet and spit out the string
>> without me having to explicitly yield control back to the hub.
>>
>
> I'm not familiar with gevent, but I wonder if it is actually running, but
> unable to write to stdout for whatever reason. I can't think that IPython
> should be interfering with it. Have you tried with a worker loop writing a
> file or something?
>
> a = 0
> while True:
>     time.sleep(2)
>     with open("test","w") as f:
>         f.write(a)
>     a += 1
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20111026/b1f62568/attachment.html 


More information about the IPython-User mailing list