Eric Wertman schrieb:
> A simple yet dangerous and rather rubbish solution (possibly more of a
> hack than a real implementation) could be achieved by using a
> technique described above:
>
> <?php
> echo exec('python foo.py');
This will spawn a Python interpreter, and not be particularly
efficient. You could just as well have used CGI.
I'm in a bit of a similar situation. I decided to use python to
solve problems where I could, in a more regimented fashion. For
instance, I have a set of functions in a script, table.py. After I
set up mod_python to handle requests to a single directory with
python, I can call this with:
<?php include("http://localhost/py/table/nodes"); ?>
embedded in the page. This is probably pretty hackish too, but at
least it doesn't spawn a new process, and I don't have to solve things
that aren't related to display with php.
You mean opening a local-loop socket instead of a anonymous socket,
hogging at least another apache process and then possibly spawning
another process if the python-script is implemented as real CGI - not
fast_cgi or python - is the better solution? I doubt that. More wasteful
in all aspects, with small to any gain at all.
Unix uses pipes as IPC all the time. I fail to see why that is "rubbish".
Diez
--
http://mail.python.org/mailman/listinfo/python-list