[mod_python] Writing to browser from C module

Alexis Iglauer aiglauer at yahoo.com
Mon Dec 11 00:22:42 EST 2000


Hi, 

me again - and with the same problem as before, just different :)

I have a Python handler which calls a C function - said C function
sometimes taking a long time to return (3+ minutes), long enough for
the browser to time out.  The way to keep the browser happy is to
occasionally send a few bytes of data its way (tried and tested).

So, I somehow need to execute req.write from inside the calculation
loop.  So I need to either a) call the python function req.write from
inside the C function or b) call the ap.rwrite (or similar) function
from inside my C loop.  Either way, I have to pass a pointer of some
form from the Python to C so that I can execute the function.  The best
result I have had so far has been a Segfault from Apache :(

I am currently wrapping my C function using SWIG, put I can pass
PyObjects directly if necessary.  Speed would be a bonus (how efficient
is it to call a Python function from inside C?).

Can anyone help me here?

Regards
Alexis


__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



More information about the Mod_python mailing list