Pep 342 (val = yield MyGenerator(foo)), synchronous os.system() that doesn't block gui event loops
Ville M. Vainio
vivainio at gmail.com
Sun Jul 26 20:20:59 CEST 2009
On Jul 23, 11:29 pm, Nick Craig-Wood <n... at craig-wood.com> wrote:
> > The syntax would be something like:
> > def work():
> > showstatus("building")
> > r = yield runshell("make")
> > showstatus("installing")
> > r = yield runshell("make install")
> > showstatus("Success")
> > mygui.startwork(work)
> > # returns immediately, runs work() gradually in the background.
> > The catch is that showstatus() would need to be run in the mainloop,
> > so running the whole thing in a thread is a no-go.
> > I imagine runshell() would be implemented in terms of QProcess, or
> > subprocess.Popen/os.system and a worker thread.
> > Anyone done this already, or do I have to roll my own?
> You might want to look at twisted, in particular
Indeed, DeferredGenerator looks pretty much what I'm interested in,
thanks for the pointer. Unfortunately, it has the big Twisted
dependency. That's probably not a showstopper, but Twisted requires a
degree of buy-in when something smaller would do.
More information about the Python-list