Apache and suexec issue that wont let me run my python script

Νικόλαος Κούρας nikos.gr33k at gmail.com
Wed Jun 5 00:35:03 EDT 2013


Here is the script:

================================
#!/usr/bin/python
# coding=utf-8

import cgitb; cgitb.enable()
import cgi, os, sys, locale, codecs
from http import cookies

#needed line, script does *not* work without it
sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach())

# initialize cookie
cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )
cookie.load( cookie )
nikos = cookie.get('nikos')

# if visitor cookie does exist
if nikos:
	message = "ΑΠΟ ΤΗΝ ΕΠΟΜΕΝΗ ΕΠΙΣΚΕΨΗ ΣΟΥ ΘΑ ΣΕ ΥΠΟΛΟΓΙΖΩ ΩΣ ΕΠΙΣΚΕΠΤΗ ΑΥΞΑΝΟΝΤΑΣ ΤΟΝ ΜΕΤΡΗΤΗ!"
	cookie['nikos'] = 'admin'
	cookie['nikos']['path'] = '/'
	cookie['nikos']['expires'] = -1		#this cookie will expire now
else:
	message  = "ΑΠΟ ΔΩ ΚΑΙ ΣΤΟ ΕΞΗΣ ΔΕΝ ΣΕ ΕΙΔΑ, ΔΕΝ ΣΕ ΞΕΡΩ, ΔΕΝ ΣΕ ΑΚΟΥΣΑ! ΘΑ ΕΙΣΑΙ ΠΛΕΟΝ Ο ΑΟΡΑΤΟΣ ΕΠΙΣΚΕΠΤΗΣ!!"
	cookie['nikos'] = 'admin'
	cookie['nikos']['path'] = '/'
	cookie['nikos']['expires'] = 60*60*24*30*12		#this cookie will expire in a year


print( cookie, "Content-type: text/html; charset=utf-8\n", message )

sys.exit(0)
===================================

This doesn't make sense to me at all.I'll iam tryign to set is a cookie, iwas so happy finally disablin bloody 'suexec' and now this.

[Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/koukos.py' failed 
[Wed Jun 05 06:49:56 2013] [error] [client 46.12.95.59] Premature end of script headers: koukos.py



More information about the Python-list mailing list