Newbie CGI problem

Rory Campbell-Lange rory at campbell-lange.net
Sun Feb 20 17:30:55 EST 2005


On 18/02/05, Peter Otten (__peter__ at web.de) wrote:
> Rory Campbell-Lange wrote:
> 
> > #!/usr/bin/python
> > import cgi
> > print "Content-type: text/html\n\n"
> > print "hi"
> > 
> > Gives me the following in my browser:
> > 
> > '''
> > hi
> > Content-type: text/html
> > 
> > 
> > hi
> > '''
> > 
> > Why are there two 'hi's?
> 
> You have chosen a bad name for your script: cgi.py.
> It is now self-importing. Rename it to something that doesn't clash with the
> standard library, and all should be OK.

Thanks very much. Ouch!
Rory

-- 
Rory Campbell-Lange 
<rory at campbell-lange.net>
<www.campbell-lange.net>



More information about the Python-list mailing list