[python-win32] ASP/Python problems with HTMLgen...
Brian Jarrett
bjarrett at garcoschools.org
Mon Sep 1 23:16:53 EDT 2003
> I'm guessing that 'doc.write()' writes to stdout, which is
> useless in an ASP
> script. You'll need to get the string that doc.write
> generates somehow, and
> call Response.Write with it.
>
> Something like this might work:
>
> <%@ Language = Python %>
> <%
> from HTMLgen import *
> from cStringIO import StringIO
>
> doc = SimpleDocument(title="Hello")
> doc.append(Heading(1, "Hello World"))
> f = StringIO()
> doc.write(f)
> Response.Write(f.getvalue())
>
> %>
>
> -Andrew.
>
Now that you mention it, I see several people mention in the archives the problem with print going to stdout instead of the asp page. The "<html><body></body></html>" must be auto-generated for all ASP pages.
Unfortunately, your solution did not work, I got another error. I have seen some other posts about this sort of problem, so if I get a good solution, I'll post it back here.
I was hoping to be able to take what I can generate from command line and just have ASP display it, but it's looking increasingly doubtful that I will be able to just "cut N paste" my scripts in.
That would be a good module to develop. I'll have to learn more in this area.
Brian
More information about the Python-win32
mailing list