I'm tryng to write my first Python script - so far all I can get it to do is produce an Internal Server Error (though my script runs OK at the command line on my local PC). Can someone just tell my how to do a Hello World Python script on TCH, just to get me started?<br /><br />Thanks - Rowan<!--content-->
I just created and tested a guick one;<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#!/usr/bin/python<br /><br />print "Content-type: text/html\n\n"<br />print "<html>Hello world!</html>"<!--c2--></div><!--ec2--><br />in a file hello.cgi, and set the permissions to 755 (so that you have execute permission), then just go to that file in your browser.<br /><br />This only has the very basics - so of course hasn't got the full headers, and correct HTML ... but should get you started.<!--content-->
Andy - many thanks. I copied your exact code and still got Internal Server Error, but eventually pinned it down to file format - by default my editor uses MS-DOS (CR LF) line termination. When I changed it to LF only, it started working.<br /><br />Now I can try to write some <i><b>real </b></i>code!<br /><br />Thanks again - Rowan<!--content-->
I just created and tested a guick one;<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#!/usr/bin/python<br /><br />print "Content-type: text/html\n\n"<br />print "<html>Hello world!</html>"<!--c2--></div><!--ec2--><br />in a file hello.cgi, and set the permissions to 755 (so that you have execute permission), then just go to that file in your browser.<br /><br />This only has the very basics - so of course hasn't got the full headers, and correct HTML ... but should get you started.<!--content-->
Andy - many thanks. I copied your exact code and still got Internal Server Error, but eventually pinned it down to file format - by default my editor uses MS-DOS (CR LF) line termination. When I changed it to LF only, it started working.<br /><br />Now I can try to write some <i><b>real </b></i>code!<br /><br />Thanks again - Rowan<!--content-->