[Zope] - Bobo and Stdout

Dr. Armin Tschammer Armin.Tschammer@oi42.kwu.siemens.de
Wed, 13 Jan 1999 13:04:30 +0100


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()

----------------------------

Everthing works fine, when I call that method via the URL:
http://myserver/cgi-bin/hello/hello

---------------------------
Now, when I make the commentated line  print "rrr"  active, I get

Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.
...

This seems a little bit strange to me, because a mechanism, which works
with the return values of functions
should not be confused from the stdout or am I wrong (I know the cgi
mechanism) ?
On the other side the following doesn't work, too:
   ...
   print X3()
   # return X3()

That means to me: stdout alone makes no sense, too.
All together that would mean, I have to sustain the return value of the
function which
I want to publish, but I must not pollute the stdout.

Now the real problem is:
When I am calling  same functions in that python-modul for calculations
and I want to show the results in the browser, I have to take care that
within the calculations nothing is written to the stdout.
Is that the way I have to go ?



   Armin