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.in...@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
--
https://mail.python.org/mailman/listinfo/python-list