Since the other thread gone into the wild, i choosed not to participate any 
longer and i state the question in this new thread.

'python files.py' interprets without an error.
Problem is that when via browser - http://superhost.gr/cgi-bin/koukos.py
i receive the following:

-------------------------------
root@nikos [/home/nikos/www/cgi-bin]# ls
./  ../  convert.py*  files.py*  .htaccess  koukos.py*  metrites.py*  
pelatologio.py*

root@nikos [/home/nikos/www/cgi-bin]# tail -F /usr/local/apache/logs/error_log &

root@nikos [/home/nikos/www/cgi-bin]# [Wed Jun 05 22:47:43 2013] [error] 
[client                                                                         
                79.103.41.173] (2)No such file or directory: exec of 
'/home/nikos/public_html/c                                                      
                                  gi-bin/koukos.py' failed
[Wed Jun 05 22:47:43 2013] [error] [client 79.103.41.173] Premature end of 
scrip                                                                           
             t headers: koukos.py
----------------------------------

What file does the error complain it cannot find? I do not understand its 
message. Here is the code of koukos.py


-----------------------------
#!/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)
---------------------------------

All it tries to do is to set a cookie.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to