[Twisted-Python] deferToThread question
Michele Petrazzo
michele.petrazzo at unipex.it
Fri Aug 20 03:07:20 MDT 2004
I want to call a block function. I use deferToThread to call it, so
something like this:
def block_func():
os.popen3(my_soft) #my_soft is a blocking software
print 1/0 # Simulate an error
If I use normal (not defer) call, so: block_func(), the exception is
raised after my_soft is closed.
I i call block_func with defer, so:
def block_func_err(err):
print err
t = threads.deferToThread(block_func)
t.addErrback(block_func_err)
the error is raised before my_soft is closed.
Why? Is it right?
S.O. win2k and mdk10, both with py 2.3.4, twisted 1.3.0, wxpy 2.4.2 and
user of wxsupport, not wxreactor.
Thanks,
Michele Petrazzo
More information about the Twisted-Python
mailing list