sylvest Posted April 7, 2007 Posted April 7, 2007 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? Thanks - Rowan Quote
TCH-Andy Posted April 7, 2007 Posted April 7, 2007 I just created and tested a guick one; >#!/usr/bin/python print "Content-type: text/html\n\n" print "<html>Hello world!</html>" 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. This only has the very basics - so of course hasn't got the full headers, and correct HTML ... but should get you started. Quote
sylvest Posted April 7, 2007 Author Posted April 7, 2007 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. Now I can try to write some real code! Thanks again - Rowan Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.