Callback from Python to the calling system

Alex Martelli aleaxit at yahoo.com
Fri Apr 27 03:54:46 EDT 2001


"Marten Feldtmann" <marten at phoenix-edv.netzservice.de> wrote in message
news:3AE91594.BF7E0769 at phoenix-edv.netzservice.de...
> I've the following idea:
>
> I would like to call the Python interpreted from our main application
> and I want to give a callback-procedure to the Python program.

Fine.


> Python itselfs now should try to callback the calling application via
> this callback and transfers some data ...
>
> How can this be done ???

By exposing the "callback" as a method on a Python extension
module.

The demo.c example source in Demo/embed/ in the source Python
distribution exemplifies all you need -- the Python code the
demo is running doesn't actually call the "callback function"
that has been defined and exposed as xyzzy.foo(), but that
shouldn't be hard to remedy:-).


Alex






More information about the Python-list mailing list