Jump to content

Trouble Executing A Cgi Script From Ssi


dcasal
 Share

Recommended Posts

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...