[Tutor] FW: HTMLgen question

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Sep 3 20:12:47 CEST 2004

On Fri, 3 Sep 2004, David Carter wrote:

> I decided to try out the HTMLgen module today.

[some text cut]

> I'm running Python 2.3.2 under Win2K Server with IIS as an ASP-type
> page. So I just tried the simplest thing I could think of:
> *******BEGIN CODE*****************
> <%
> import HTMLgen
> a = HTMLgen.BasicDocument()
> Response.Write(a)
> %>
> *******END CODE*******************

[error message cut]

> If I run this in IDLE, replacing the "Response.Write(a)" with "print a",
> I get a nice, complete HTML document, which I can view in my Browser.
> Anybody know what's up with this?

Hi David,

One difference between:



    print a

is that the 'print' statement implicitely turns whatever it's given into a
string, by calling str() on its arguments.

The error message that you're getting:

> Traceback (most recent call last):
> File "<Script Block >", line 3, in ?
>     Response.Write(a)
> File "<COMObject Response>", line 2,
>     in Write TypeError:
> Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object.

implies that Response.Write() function expects its argument to be a string

So you may need to do something like:


Good luck to you!

More information about the Tutor mailing list