Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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; 'subject:error': 0.03; 'else:': 0.03; 'skip:f 70': 0.09; 'subject:parsing': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; '6:30': 0.16; 'list):': 0.16; 'none.': 0.16; '\xc2\xa0if': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'skip:f 30': 0.19; 'feb': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'skip:i 40': 0.24; 'cc:2**0': 0.24; '>': 0.26; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'getting': 0.31; 'branches': 0.31; 'skip:i 60': 0.31; 'url:python': 0.33; 'level.': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'skip:f 40': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'error.': 0.37; 'pm,': 0.38; 'url:mail': 0.40; 'skip:\xc2 10': 0.60; 'skip:f 50': 0.65; 'to:addr:gmail.com': 0.65; '2015': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kUfjGlb88YrfsVEmCjLT6MXRgrslsvM4Xkywd58SQoo=; b=W1wo3XGwy++pn7XtUnDa/HFO7vlhIiC/zvN9CSOgp4eEokrUKeXj4FOQCVZOd3LteQ xcIPIxs8CEkqZBK5s5Ugzs1d7cIyXfld5egTIzgENwm5kBZ1Egg9qAQc0JOg364V/Vo0 2SAAuNOlWLcEF8djbH1MaQhZq28eCf0um6j4AuLGP2o11XE7hBaBLXsqL+P3f95rZeyY 3KstUkGJ7TlcgxXWKDdu9+zTZ7pKn6HNcQKWh06tXONaT94Z6K7rdLQgZr/SQWv6JxIJ 3Xoo0Kf0dAi7x21cPLEjiEJuQAbIyBiOwwY4oe8MfNqEfgupMguhZwEUKbEVvEYE/qts Dhwg== MIME-Version: 1.0 X-Received: by 10.60.134.200 with SMTP id pm8mr15062369oeb.61.1423556963943; Tue, 10 Feb 2015 00:29:23 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Feb 2015 13:59:23 +0530 Subject: Re: Varable parsing error with python From: OmPs To: Chris Angelico Content-Type: multipart/alternative; boundary=047d7b41783127490e050eb7afdf Cc: python mail list 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: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423556967 news.xs4all.nl 2937 [2001:888:2000:d::a6]:44420 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85438 --047d7b41783127490e050eb7afdf Content-Type: text/plain; charset=UTF-8 On 10 Feb 2015 13:12, "Chris Angelico" wrote: > > On Tue, Feb 10, 2015 at 6:30 PM, OmPs 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. > Tried that as well getting the same error. > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list --047d7b41783127490e050eb7afdf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On 10 Feb 2015 13:12, "Chris Angelico" <rosuav@gmail.com> wrote:
>
> On Tue, Feb 10, 2015 at 6:30 PM, OmPs <torque.india@gmail.com> wrote:
> >=C2=A0 =C2=A0 =C2=A0def _getPackgeVersion(xmlfile, p):
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0package =3D str(p)
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if isinstance(fpmdict["appl= ication"]["package"], list):
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for i in fpmdict[&= quot;application"]["package"]:
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if i= ["@name"] =3D=3D p:
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0_pkgVersion =3D i["version"]
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_pkgversion =3D fp= mdict["application"]["package"]["version"] > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return _pkgVersion=
>
> One of your branches doesn't have a return statement in it, so Pyt= hon
> just returns None. You may want to unindent that return statement one<= br> > level.
>
Tried that as well getting the same error.
> ChrisA
> --
> https= ://mail.python.org/mailman/listinfo/python-list

--047d7b41783127490e050eb7afdf--