[Zope] - Bobo and Stdout

John Mitchell johnm@magnet.com
Wed, 13 Jan 1999 11:09:39 -0500


On Wed, 13 Jan 1999, Dr. Armin Tschammer wrote:

> I publish the following Modul with Bobo:
> Very simple:
> 
> hello.py:
> 
> import sys, os, time
> import DocumentTemplate
> 
> lib=sys.path[0]
> sys.path.append(os.path.join(lib,'DT'))
> 
> def hello():
>     "Display a greeting"
>     # print "rrr"
>     X3 = DocumentTemplate.HTMLFile(lib+'/hello.dtml')
>     return X3()

> Now, when I make the commentated line  print "rrr"  active, I get
> 	Internal Server Error


The "print" goes directly to the webserver, which confused it: it expects
HTTP headers like "HTTP/1.0 200 Okay".

The "return" sends your data to *Zope*, which then does the header stuff
for you.  Same with cookies, content-type, etc.

Summary: dont use 'print', or redirect stdout to a log file.


- j