dcasal Posted November 10, 2005 Share Posted November 10, 2005 Hello everybody! I'm having trouble executing a tiny Python CGI script on server68. Although the following works fine: <!--#echo var="DATE_LOCAL" --> This won't: <!--#exec cgi="cgi-bin/thomastime2.cgi" --> This is the script: >#!/usr/bin/python import cgi import datetime print "Content-type: text/plain\r\n\r\n", "hello" birthday = datetime.date(1955, 4, 1) today = datetime.date.today() age = today - birthday print age.days, "days ago" The permissions are 0755 and it is definitely in cgi-bin. The error log I can see from cpanel says: >[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 I've gone through the usual checks for this kind of error as instructed by Google, but no joy :-( Please please help? d Quote Link to comment Share on other sites More sharing options...
TweezerMan Posted November 10, 2005 Share Posted November 10, 2005 I believe the problem stems from your use of the datetime module: >import datetime 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. Hope this helps... Quote Link to comment Share on other sites More sharing options...
dcasal Posted November 10, 2005 Author Share Posted November 10, 2005 I believe the problem stems from your use of the datetime module: >import datetime 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. Hope this helps... ARGH! That's such a pain! I'm not even sure how to do that with the time module instead... Do you know of some way I might be able to install just the datetime module in my home directory, or something? So frustrating :-( d Quote Link to comment Share on other sites More sharing options...
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.