[Pythonmac-SIG] asyncore and IDE
Just van Rossum
just@letterror.com
Sun, 15 Apr 2001 20:11:06 +0200
Phil Christensen wrote:
> i've been using the Python IDE to develop a asyncore-based sever
> program. Whenever I call asyncore.loop(), of course, it hangs the
> program....
>
> of course, Python Interpreter works fine, but doesn't have the great
> debugging abilities of the IDE....
>
> is there any way to use the IDE for this? I've tried putting the
> asyncore.loop() call in a separate thread, and it keeps it from
> hanging,
> but doesn't seem to be actually working....
I have done this successfully by registring asyncore.poll as an idle callback to
the IDE. This is pretty much undocumented (I might have even invented that
mechanism especialloy _for_ asyncore, I forgot...), so I'll dig it up for you.
[search, search...]
Ok, here's what you do:
import W
app = W.getapplication()
app.addidlefunc(myidlefunc) # in your case: asyncore.poll
You can remove an idle func with
app.removeidlefunc(myidlefunc)
(If an idle callback raises an excption, a traceback is printed to the output
window, and the callback is removed from the idle func list. For details, see
Wapplication.py.)
It worked fairly nicely with asyncore!
Just