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: 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: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <09f62f17-9a36-4b8c-a7db-e0dfd95ec5c4@googlegroups.com> Subject: Re: TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' From: =?ISO-8859-7?B?zd/q7/Igw+rxMzPq?= 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 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=3Dutf-8 import cgitb; cgitb.enable() import cgi, os, sys from http import cookies # initialize cookie cookie =3D cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') ) cookie.load( cookie ) nikos =3D cookie.get('nikos') # if visitor cookie does exist if nikos: msg =3D "=C1=D0=CF =D4=C7=CD =C5=D0=CF=CC=C5=CD=C7 =C5=D0=C9=D3=CA=C5=D8= =C7 =D3=CF=D5 =C8=C1 =D3=C5 =D5=D0=CF=CB=CF=C3=C9=C6=D9 =D9=D3 =C5=D0=C9=D3= =CA=C5=D0=D4=C7 =C1=D5=CE=C1=CD=CF=CD=D4=C1=D3 =D4=CF=CD =CC=C5=D4=D1=C7=D4= =C7!" cookie['nikos'] =3D 'admin' cookie['nikos']['path'] =3D '/' cookie['nikos']['expires'] =3D -1 #this cookie will expire now else: msg =3D "=C1=D0=CF =C4=D9 =CA=C1=C9 =D3=D4=CF =C5=CE=C7=D3 =C4=C5=CD =D3= =C5 =C5=C9=C4=C1, =C4=C5=CD =D3=C5 =CE=C5=D1=D9, =C4=C5=CD =D3=C5 =C1=CA=CF= =D5=D3=C1! =C8=C1 =C5=C9=D3=C1=C9 =D0=CB=C5=CF=CD =CF =C1=CF=D1=C1=D4=CF=D3= =C5=D0=C9=D3=CA=C5=D0=D4=C7=D3!!" cookie['nikos'] =3D 'admin' cookie['nikos']['path'] =3D '/' cookie['nikos']['expires'] =3D 60*60*24*30*12 #this cookie will expire in= a year print ( "Content-type: text/html; charset=3Dutf-8\n" ) print( cookie, msg ) sys.exit(0) ima getting internal server error.