Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'else:': 0.03; 'received:209.85.223': 0.03; 'subject:parsing': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; '6:30': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'list):': 0.16; 'none.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'skip:f 30': 0.19; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'skip:i 40': 0.24; 'cc:2**0': 0.24; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'branches': 0.31; 'level.': 0.33; 'subject:with': 0.35; 'received:209.85': 0.35; 'received:google.com': 0.35; 'skip:f 40': 0.36; 'received:209': 0.37; 'pm,': 0.38; '2015': 0.84; 'to:none': 0.92 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:cc :content-type; bh=/Q9A4zfHU/77MDqmv/b1crwjhPG6s2/EgxZ1WFwp0iU=; b=uJ+/09NW+UjjDuA49y7xeOsGIJ5g43SYjimlj++Wxe2Qzl/9w5PvG3/RoSRfWECRYE yHhMHNH/23qLc1/Q19ABfhWLlT393nUdyTq80H9DUC7heYxTrYHTg5u2i/0TDF18ZOWa HSgw4zdDlIVr8fIEGLydjjRLewO8bVQY2ls3GanmDVCruzwWZoVvr/H4fUrqVl4DiGVi BVycyxRkTwqIiNG67L7taf376EgN7STZ2Xn9uocS52je3NRp30WJzL2OAHTM0CzWJ74b 3Jr0aS8YNWZFTg4nETf4BiSUO1wXzyYlYw6mJ8M/xtY2lAQ3v1Kkvi57cBcjSQPPrQd9 rwoA== MIME-Version: 1.0 X-Received: by 10.50.61.238 with SMTP id t14mr21861846igr.34.1423553982255; Mon, 09 Feb 2015 23:39:42 -0800 (PST) In-Reply-To: References: Date: Tue, 10 Feb 2015 18:39:42 +1100 Subject: Re: Varable parsing error with python From: Chris Angelico Cc: python mail list Content-Type: text/plain; charset=UTF-8 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423553990 news.xs4all.nl 2863 [2001:888:2000:d::a6]:51879 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3681 X-Received-Body-CRC: 4201913907 Xref: csiph.com comp.lang.python:85432 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. ChrisA