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


Groups > comp.lang.python > #85469

Re: Varable parsing error with python

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; 'else:': 0.03; 'exception,': 0.09; 'subject:parsing': 0.09; 'python': 0.11; 'def': 0.12; '6:30': 0.16; "he'd": 0.16; 'list):': 0.16; 'none.': 0.16; 'return,': 0.16; 'set,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'skip:f 30': 0.19; 'value.': 0.19; 'feb': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'skip:i 40': 0.24; 'skip:_ 20': 0.27; 'gets': 0.27; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; "doesn't": 0.30; 'statement': 0.30; 'getting': 0.31; 'branches': 0.31; 'level.': 0.33; 'subject:with': 0.35; 'but': 0.35; 'found.': 0.36; 'skip:f 40': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'skip:u 10': 0.60; 'such': 0.63; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; '2015': 0.84
Date Tue, 10 Feb 2015 15:40:45 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Varable parsing error with python
References <CAFo8oMD+JZPuw3WedDOPDUo1+M+Qh-08rd57SfZneFFAG7u4mQ@mail.gmail.com> <mailman.18599.1423553990.18130.python-list@python.org> <mbdid6$1i2$3@dont-email.me>
In-Reply-To <mbdid6$1i2$3@dont-email.me>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:R1zkIx1QPzqSoQ26oP+7yy/wXxySRBUx9AHlQP+gONU J0+IOJwuL4ZxHytAtQgJMjz/y5r/U8RKvkwT5hjBgZ/FeU6wYV rdaRmlfTkTTfixj9OmRSxP62aB74X7ZMdfH47FdJAG4Gs5E9FH 1ShseqQtscGyLWmzUydTm0VFoVCcmpfCcKvi1vMGw3CWndHWo9 ExNpp86sA2j48dS2DLa1/ofvmox8pputwXA0qa7cN7UQ+uLJR6 pHNO/KhBylegW72Eb4UHW11o9dtK3JmCqZiRSsRvNR6yDaC7fO KkDqFjFUt6JmcTO5qbT3uVysWuME2ILPVGUj1LiKLn2vENdPQ= =
X-UI-Out-Filterresults notjunk:1;
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18623.1423600858.18130.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1423600858 news.xs4all.nl 2829 [2001:888:2000:d::a6]:50131
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85469

Show key headers only | View raw


On 02/10/2015 01:24 PM, Denis McMahon wrote:
> On Tue, 10 Feb 2015 18:39:42 +1100, Chris Angelico wrote:
>
>> On Tue, Feb 10, 2015 at 6:30 PM, OmPs <torque.india@gmail.com> wrote:
>>>      def _getPackgeVersion(xmlfile, p):
>>>          package = str(p)
>>>          if isinstance(fpmdict["application"]["package"], list):
>>>              for i in fpmdict["application"]["package"]:
>>>                  if i["@name"] == p:
>>>                      _pkgVersion = i["version"]
>>>          else:
>>>              _pkgversion = fpmdict["application"]["package"]["version"]
>>>              return _pkgVersion
>>
>> One of your branches doesn't have a return statement in it, so Python
>> just returns None. You may want to unindent that return statement one
>> level.
>
> Even if he unindents the return, it will still return None if it doesn't
> find an i such that i["@name"] == p, as _pkgVersion only gets set if such
> a match is found.

But if _pkgVersion weren't set, he'd be getting UnboundLocalError 
exception, not a None value.
>


-- 
DaveA

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


Thread

Re: Varable parsing error with python Chris Angelico <rosuav@gmail.com> - 2015-02-10 18:39 +1100
  Re: Varable parsing error with python Denis McMahon <denismfmcmahon@gmail.com> - 2015-02-10 18:24 +0000
    Re: Varable parsing error with python Dave Angel <davea@davea.name> - 2015-02-10 15:40 -0500

csiph-web