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


Groups > comp.lang.python > #46059

Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

X-Received by 10.224.3.131 with SMTP id 3mr3334293qan.5.1369564339020; Sun, 26 May 2013 03:32:19 -0700 (PDT)
X-Received by 10.49.30.105 with SMTP id r9mr2085219qeh.27.1369564338963; Sun, 26 May 2013 03:32:18 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!t14no813280qam.0!news-out.google.com!y6ni51517qax.0!nntp.google.com!ch1no1192385qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 26 May 2013 03:32:18 -0700 (PDT)
In-Reply-To <mailman.2171.1369560291.3114.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=46.12.46.11; posting-account=DYJQ-woAAACEPH85Au2BhUVfFTfSfVa4
NNTP-Posting-Host 46.12.46.11
References <ffb99274-6844-4638-bb4b-4312c0b246c2@googlegroups.com> <mailman.2169.1369556595.3114.python-list@python.org> <eb43bee9-199b-49ec-a257-c72c9fc9ebce@googlegroups.com> <mailman.2171.1369560291.3114.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <09f62f17-9a36-4b8c-a7db-e0dfd95ec5c4@googlegroups.com> (permalink)
Subject Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'
From Νίκος Γκρ33κ <nikos.gr33k@gmail.com>
Injection-Date Sun, 26 May 2013 10:32:18 +0000
Content-Type text/plain; charset=ISO-8859-7
Content-Transfer-Encoding quoted-printable
X-Received-Bytes 2698
Xref csiph.com comp.lang.python:46059

Show key headers only | View raw


Perhaps cna you help a bit with tha too:
used to work in 2.6 but not with 3.3.1

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


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

ima getting internal server error.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 01:08 -0700
  Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Peter Otten <__peter__@web.de> - 2013-05-26 10:23 +0200
    Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 02:12 -0700
      Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Peter Otten <__peter__@web.de> - 2013-05-26 11:25 +0200
        Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 03:32 -0700
  Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 06:00 -0700
    Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Chris Angelico <rosuav@gmail.com> - 2013-05-26 23:10 +1000
      Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' nagia.retsina@gmail.com - 2013-05-26 08:00 -0700
        Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Chris Angelico <rosuav@gmail.com> - 2013-05-27 01:24 +1000
          Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 08:45 -0700
            Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-26 09:10 -0700
              Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-26 17:45 +0100
                Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-05-27 23:01 -0700
        Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-05-26 17:43 +0100
    RE: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-26 17:23 +0300

csiph-web