Trouble Executing A Cgi Script From Ssi

liunx

Guest
Hello everybody!<br /><br />I'm having trouble executing a tiny Python CGI script on server68. Although the following works fine:<br /><br /><!--#echo var="DATE_LOCAL" --><br /><br />This won't:<br /><br /><!--#exec cgi="cgi-bin/thomastime2.cgi" --><br /><br />This is the script:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#!/usr/bin/python<br /><br />import cgi<br />import datetime<br /><br />print "Content-type: text/plain\r\n\r\n", "hello"<br /><br />birthday = datetime.date(1955, 4, 1)<br /><br />today = datetime.date.today()<br /><br />age = today - birthday<br /><br />print age.days, "days ago"<!--c2--></div><!--ec2--><br /><br />The permissions are 0755 and it is definitely in cgi-bin. The error log I can see from cpanel says:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->[Thu Nov 10 12:18:08 2005] [error] [client 139.222.132.225] Premature end of script headers: /home/thomaspl/public_html/cgi-bin/thomastime2.cgi<!--c2--></div><!--ec2--><br /><br />I've gone through the usual checks for this kind of error as instructed by Google, but no joy :-(<br /><br />Please please help?<br /><br />d<!--content-->
I believe the problem stems from your use of the datetime module:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->import datetime<!--c2--></div><!--ec2--><br />From what I've found on Google, the datetime module is a new module added in Python version 2.3. The last time I checked, my server (and I presume all other TCH servers) were running Python 2.2.3, so the datetime module would not be an available module for python scripts to use.<br /><br />Hope this helps...<!--content-->
<!--quoteo(post=155073:date=Nov 10 2005, 01:46 PM:name=TCH-David)--><div class='quotetop'>QUOTE(TCH-David @ Nov 10 2005, 01:46 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=155073"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I believe the problem stems from your use of the datetime module:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->import datetime<!--c2--></div><!--ec2--><br />From what I've found on Google, the datetime module is a new module added in Python version 2.3. The last time I checked, my server (and I presume all other TCH servers) were running Python 2.2.3, so the datetime module would not be an available module for python scripts to use.<br /><br />Hope this helps...<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />ARGH! That's such a pain!<br /><br />I'm not even sure how to do that with the time module instead...<br /><br />Do you know of some way I might be able to install just the datetime module in my home directory, or something?<br /><br />So frustrating :-(<br /><br />d<!--content-->
 
Back
Top