You're right, of course, and I do appreciate it.  I generally am calling
functions and returning strings and then printing the entire string.
For example:

def SomeFunc():
  lstrRetVal = ''
  lstrRetVal += 'Content-type: text/html\n\n'
  lstrRetVal += more HTML here...
  return lstrRetVal

Then, the calling code does:

print SomeFunc()

In this case, the extra new line character is appropriate.  Somehow, the
extra new line character slipped in on the print statement in my upload
sample code (I probably copied from a function that returns a string).  But
thanks just the same...

Just to be complete (so that no one comments about string concatenation
efficiency), in a real application I would generally use triple quotes for
HTML (or append to a list and then .join into a string at the end)...

Thanks to all for your help.

"Tim Roberts" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Doug Helm" <[EMAIL PROTECTED]> wrote:
>
> >Hey, Folks:
> >
> >I'm trying to write a very simple file upload CGI.  I'm on a Windows
server.
> >I *am* using the -u switch to start Python for CGIs, as follows:
> >
> >c:\python\python.exe -u %s %s
> >
> >I *do* have write permissions on the directory I'm trying to write to.
But,
> >when I click submit, it just hangs.  Any help would be greatly
appreciated.
> >Thanks.  Here's the code...
> >
> >Upload.py
> >
> >import cgi
> >
> >print "content-type: text/html\n\n"
>
> I see you got your problem solved, but you should know there is a problem
> with this line.  The print statement automatically adds an end-of-line, so
> this will actually end up producing TWO blank lines after the header.  You
> should use this:
>
>     print "Content-type: text/html\n"
> --
> - Tim Roberts, [EMAIL PROTECTED]
>   Providenza & Boekelheide, Inc.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to