[Tutor] python cgi single double quotes

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 19 15:16:22 EDT 2016


On 19/07/16 19:43, nitin chandra wrote:

> Now I have taken a VPS, using command line, I installed apache2.4,
> python 2.7, but I am not able to use the same code with triple quotes
> (""") to open and close the code block.
> 
> I am forced to use
> 
> print "Content-type:text/html\r\n\r\n"
> print '<html>'
> print '....'

> Do I need to do some thing to apache config such that I can use Triple
> quote to embed.

Triple quotes should work anywhere Python works.
But first I'd check your python environment.
Which interpreter is actually running for example?

Try

import sys
...
print "<p> + "sys.version + "</p>"
...

The 500 error sounds like an apache setup or maybe permissions
issue. Are your files readable/executable by Apache?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list