[Twisted-web] How to display python script output and php path

Jean-Paul Calderone exarkun at divmod.com
Fri Apr 7 10:33:39 CDT 2006

On Fri, 07 Apr 2006 09:58:24 -0400, Normand Savard <nsavard at mapgears.com> wrote:
>Normand Savard wrote:
>>I'm using an existing twisted python script to serve my Web pages (see 
>>below) on Linux.  When I set the URL to point to a python script (see 
>>example below), the script executes well.  I see the output result in the 
>>shell window but nothing is shown in the browser window.  Could you point 
>>me out what is missing in this script to display the output of a script?  I 
>>looked in the mailing list archive and could not find my answer.
>>And how could I change the filter path to the php executable.  Actually the 
>>path is set to "/usr/bin/php4" and I want to set it to 
>Two days ago I sent this post to this list (notice that I removed the script 
>to not overload this email)  without any answer maybe because my question 
>was not clear enough.  So I try again.  I have a Twisted Web server to serve 
>my HTML pages.  When I point my URL to an external Python script, the script 
>is executed because I can see the return value of this script in the shell 
>where I started Twisted Web.  But the return value is not displayed in the 
>browser window.
>Does someone know why Twisted Web server does not display the return value 
>of my Python script in the browser window? Or what is the output stream to 
>print to in my python script for Twisted to display the text in the browser?
>Any help would be really appreciate.  Or if someone could point me out to 
>some Twisted documentation about this topic.

If the output is going to a terminal window, it's not being sent to the right place.  I am not sure what kind of external Python script you are trying to use, but it sounds like it is using "print" and expecting the results to end up on a web page.  Generally speaking, this isn't how dynamic resources in Twisted Web work - you need to write something to the request object for it to end up in the browser.

Hope this helps,


More information about the Twisted-web mailing list