[Tutor] how to run php scripts in pylons framework?

vince spicer vinces1979 at gmail.com
Fri Oct 2 16:32:17 CEST 2009

On Fri, Oct 2, 2009 at 1:24 AM, goooogi goooogi <gopcos at gmail.com> wrote:

> Dear All,
>  I have some php scripts which I don't want to rewrite in python. How can I
> run php Scripts in python?
> Thanks in advance
> Googi G
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

Although rewriting is a better option, you can use the subprocess module to
make system calls to the php interpreter

import subprocess

#simple caller, disguard output

subprocess.call("php /path/to/my/old/script.php")

# if you want output

proc = subprocess.Popen("php /path/to/my/script.php", shell=True,

script_response = proc.stdout.read()

Hope that helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091002/db88e55b/attachment.htm>

More information about the Tutor mailing list