Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46468 > unrolled thread

Is this code correct?

Started byΝίκος Γκρ33κ <support@superhost.gr>
First post2013-05-30 05:25 -0700
Last post2013-05-30 05:54 -0700
Articles 11 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 05:25 -0700
    Re: Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 05:31 -0700
      Re: Is this code correct? Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:59 +1000
        Re: Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 06:03 -0700
      Re: Is this code correct? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-30 14:05 +0100
        Re: Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 06:30 -0700
      Re: Is this code correct? Chris Angelico <rosuav@gmail.com> - 2013-05-30 23:36 +1000
        Re: Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 06:45 -0700
          Re: Is this code correct? Cameron Simpson <cs@zip.com.au> - 2013-06-01 09:46 +1000
    Re: Is this code correct? Chris Angelico <rosuav@gmail.com> - 2013-05-30 22:34 +1000
      Re: Is this code correct? Νίκος Γκρ33κ <support@superhost.gr> - 2013-05-30 05:54 -0700

#46468 — Is this code correct?

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 05:25 -0700
SubjectIs this code correct?
Message-ID<95c02d4f-1d3b-45a9-8b22-1eb7cebafe1b@googlegroups.com>
#!/usr/bin/python3
# coding=utf-8

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

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

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


#needed line, script does *not* work without it
sys.stdout = os.fdopen(1, 'w', encoding='utf-8')

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

sys.exit(0)

[toc] | [next] | [standalone]


#46471

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 05:31 -0700
Message-ID<6c380793-6f1f-4d5c-9a55-dcb21079511a@googlegroups.com>
In reply to#46468
This is my last question, everythign else is taken care of.

i cant test thjis coe online because i receive this

[Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file
[Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied
[Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py
[Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml

when i tail -F /usr/local/apache/logs/error_log &

maybe it is correct but it wont run, perhaps somethign with linux?

[toc] | [prev] | [next] | [standalone]


#46484

FromChris Angelico <rosuav@gmail.com>
Date2013-05-30 22:59 +1000
Message-ID<mailman.2417.1369918764.3114.python-list@python.org>
In reply to#46471
On Thu, May 30, 2013 at 10:31 PM, Νίκος Γκρ33κ <support@superhost.gr> wrote:
> This is my last question, everythign else is taken care of.
>
> i cant test thjis coe online because i receive this
>
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml
>
> when i tail -F /usr/local/apache/logs/error_log &
>
> maybe it is correct but it wont run, perhaps somethign with linux?

I don't know, why not ask on a Linux mailing list? Or have you run
them out of patience too?

ChrisA

[toc] | [prev] | [next] | [standalone]


#46487

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 06:03 -0700
Message-ID<8aa9684c-fda6-4549-ac1e-764b815f2f45@googlegroups.com>
In reply to#46484
Τη Πέμπτη, 30 Μαΐου 2013 3:59:21 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Thu, May 30, 2013 at 10:31 PM, Νίκος Γκρ33κ <support@superhost.gr> wrote:
> 
> > This is my last question, everythign else is taken care of.
> 
> >
> 
> > i cant test thjis coe online because i receive this
> 
> >
> 
> > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file
> 
> > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied
> 
> > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py
> 
> > [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml
> 
> >
> 
> > when i tail -F /usr/local/apache/logs/error_log &
> 
> >
> 
> > maybe it is correct but it wont run, perhaps somethign with linux?
> 
> 
> 
> I don't know, why not ask on a Linux mailing list? Or have you run
> 
> them out of patience too?
> 
> 
> 
> ChrisA

I though you guys might know because you "do" linux as well.

i tried chown "nikos:nikos ./koukos.py" but doenst do the job either.

[toc] | [prev] | [next] | [standalone]


#46488

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-05-30 14:05 +0100
Message-ID<mailman.2419.1369919108.3114.python-list@python.org>
In reply to#46471
On 30/05/2013 13:31, Νίκος Γκρ33κ wrote:
> This is my last question, everythign else is taken care of.
>
> i cant test thjis coe online because i receive this
>
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] suexec failure: could not open log file
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] fopen: Permission denied
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] Premature end of script headers: koukos.py
> [Thu May 30 15:29:33 2013] [error] [client 46.12.46.11] File does not exist: /home/nikos/public_html/500.shtml
>
> when i tail -F /usr/local/apache/logs/error_log &
>
> maybe it is correct but it wont run, perhaps somethign with linux?
>

Please ask questions unrelated to Python on a list that is unrelated to 
Python.

-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#46491

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 06:30 -0700
Message-ID<cdaa9f8d-2416-4e7e-acb4-60e19008aa0d@googlegroups.com>
In reply to#46488
Τη Πέμπτη, 30 Μαΐου 2013 4:05:00 μ.μ. UTC+3, ο χρήστης Mark Lawrence έγραψε:

> Please ask questions unrelated to Python on a list that is unrelated to 
> Python.

Okey, i will.

[toc] | [prev] | [next] | [standalone]


#46492

FromChris Angelico <rosuav@gmail.com>
Date2013-05-30 23:36 +1000
Message-ID<mailman.2421.1369920973.3114.python-list@python.org>
In reply to#46471
On Thu, May 30, 2013 at 11:05 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> Please ask questions unrelated to Python on a list that is unrelated to
> Python.

Lemme guess, he's next going to ask on the PostgreSQL mailing list. I
mean, that's unrelated to Python, right?

ChrisA

[toc] | [prev] | [next] | [standalone]


#46494

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 06:45 -0700
Message-ID<1c0db5c4-7a76-4a64-977a-b0261fda1587@googlegroups.com>
In reply to#46492
Τη Πέμπτη, 30 Μαΐου 2013 4:36:11 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:

> Lemme guess, he's next going to ask on the PostgreSQL mailing list. I
> mean, that's unrelated to Python, right?

Well Chris, i'am not that stupid :)

I intend to ask questions unrelated to Python to a list unrelated to Python but related to my subject, whish is 'suexec', that would mean a linux list.

[toc] | [prev] | [next] | [standalone]


#46633

FromCameron Simpson <cs@zip.com.au>
Date2013-06-01 09:46 +1000
Message-ID<mailman.2508.1370044015.3114.python-list@python.org>
In reply to#46494
On 30May2013 06:45, Nikos as SuperHost Support <support@superhost.gr> wrote:
| Τη Πέμπτη, 30 Μαΐου 2013 4:36:11 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
| > Lemme guess, he's next going to ask on the PostgreSQL mailing list. I
| > mean, that's unrelated to Python, right?
| 
| Well Chris, i'am not that stupid :)
| 
| I intend to ask questions unrelated to Python to a list unrelated to Python but related to my subject, whish is 'suexec', that would mean a linux list.

Actually, you need an apache httpd list for suexec. It is part of
the web server CGI implementation.
-- 
Cameron Simpson <cs@zip.com.au>

[toc] | [prev] | [next] | [standalone]


#46473

FromChris Angelico <rosuav@gmail.com>
Date2013-05-30 22:34 +1000
Message-ID<mailman.2413.1369917253.3114.python-list@python.org>
In reply to#46468
On Thu, May 30, 2013 at 10:25 PM, Νίκος Γκρ33κ <support@superhost.gr> wrote:
> #!/usr/bin/python3
> # coding=utf-8
> (chomp a whole lot of code without any indication of what it ought to do)

Why not run it and see? If it does what it ought to, it's correct; if
it does something different, it's not. Why do you expect us to do your
basic testing for you?

ChrisA

[toc] | [prev] | [next] | [standalone]


#46480

FromΝίκος Γκρ33κ <support@superhost.gr>
Date2013-05-30 05:54 -0700
Message-ID<b0fdafed-1b9d-4222-8b5e-8f78b3dc5043@googlegroups.com>
In reply to#46473
Τη Πέμπτη, 30 Μαΐου 2013 3:34:09 μ.μ. UTC+3, ο χρήστης Chris Angelico έγραψε:
> On Thu, May 30, 2013 at 10:25 PM, Νίκος Γκρ33κ <support@superhost.gr> wrote:
> 
> > #!/usr/bin/python3
> 
> > # coding=utf-8
> 
> > (chomp a whole lot of code without any indication of what it ought to do)
> 
> 
> 
> Why not run it and see? If it does what it ought to, it's correct; if
> 
> it does something different, it's not. Why do you expect us to do your
> 
> basic testing for you?
> 
> 
> 
> ChrisA

But i cannot test it locally, i just write the code upload it on my remote server and run it from there. But h=this doenst seem to be a python issue, if it is ill correct it myself, it says somehtign about some suexec....

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web