Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'operator': 0.03; 'interpreter': 0.04; "'python": 0.07; 'python': 0.09; "%s'": 0.09; 'handled.': 0.09; 'subject:error': 0.11; 'subject:python': 0.11; 'charset:iso-8859-7': 0.15; 'evaluating': 0.16; 'expression,': 0.16; 'expression.': 0.16; 'expressions.': 0.16; 'footnote': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operator.': 0.16; 'subject:when': 0.16; 'wrote:': 0.17; 'code.': 0.20; 'do.': 0.21; 'parse': 0.22; 'header :In-Reply-To:1': 0.25; 'am,': 0.27; 'first,': 0.27; 'rules': 0.27; 'message-id:@mail.gmail.com': 0.27; 'division': 0.29; 'second,': 0.29; 'fri,': 0.30; 'figure': 0.30; 'gets': 0.32; 'url:python': 0.32; 'generally': 0.32; 'to:addr:python-list': 0.33; 'languages': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'table': 0.35; 'url:org': 0.36; 'useful': 0.36; 'should': 0.36; 'level': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'step': 0.39; 'your': 0.60; 'skip:u 10': 0.60; 'most': 0.61; 'high': 0.61; "you'll": 0.62; 'more': 0.63; 'percent': 0.65; 'walk': 0.71; 'gain': 0.79; '2013': 0.84; 'url:reference': 0.84; 'step.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=2+BVJ0u3jbaLvy/kNLlrX0m3b0n8DVNA5Wm3BmDxDI4=; b=l7OdoJ6MrZxrUyNdoY5ZwttzGrmSMkTxlWCArPALQm3blV0osmQWESCzLOWcDKh5c4 B4+T0yu9vzXQRvKHEiWxfgMsrIKU/8YNi0DFKSEOpEhsB+qiWu+hpfRNBoLFOAWlHRFM I1jSfTI5k78WrgpPRsSiChUYKSXMpuv/32pGVhokD0RxVZtvmNvuEtI/sWTftq8Nq/EZ kWa2gYI0cXFM1nplOQRukQU/hsTF3bMcBMg9YnzJ0pLtnARQswqcdeOQoZ75iK534oMu Hs9yvBi3vKAYylOzVPl1j+q3i5eZYge6WgEZDFZqmj7BfFxbN2ZxG7M3f5yATYjGiGHF UmWw== MIME-Version: 1.0 X-Received: by 10.58.187.133 with SMTP id fs5mr3806956vec.40.1362669204512; Thu, 07 Mar 2013 07:13:24 -0800 (PST) In-Reply-To: References: <8e17232e-5b24-4040-9215-c4bd89f34fa2@googlegroups.com> <622d4a2d-0014-4254-b211-c8fd66510f74@googlegroups.com> Date: Fri, 8 Mar 2013 02:13:24 +1100 Subject: Re: An error when i switched from python v2.6.6 => v3.2.3 From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362669207 news.xs4all.nl 6858 [2001:888:2000:d::a6]:52673 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40783 On Fri, Mar 8, 2013 at 2:01 AM, =CD=DF=EA=EF=F2 =C3=EA=F133=EA wrote: > os.system( 'python metrites.py > %s' ) % htmltemp Manually step through what this line should do. Follow the exact same rules Python will follow in evaluating this expression. http://docs.python.org/2/reference/expressions.html#operator-precedence http://docs.python.org/3/reference/expressions.html#operator-precedence As you'll see from footnote 8 or 5 (depending on which version of the docs), your percent operator is the same one listed in the table as a division operator. Now. Go through that expression, step by step. Walk through everything the Python interpreter does. Figure out exactly what happens first, second, third. Figure out when your percent operator gets handled. Then you'll know what's wrong with that line of code. You'll also gain a very useful understanding of Python, and more generally of the way most high level languages parse expressions. ChrisA