In Python 2, the builtin function next() can not be applied to non-iterator object. This patch fixes to use the list comprehensions and avoid applying next() to a list type object.
Signed-off-by: IWASE Yusuke <[email protected]> --- ryu/lib/ovs/vsctl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ryu/lib/ovs/vsctl.py b/ryu/lib/ovs/vsctl.py index f145498..66c2d62 100644 --- a/ryu/lib/ovs/vsctl.py +++ b/ryu/lib/ovs/vsctl.py @@ -126,8 +126,8 @@ def datum_from_string(type_, value_string, symtab=None): def ifind(pred, seq): try: - return next(filter(pred, seq)) - except StopIteration: + return [i for i in seq if pred(i)][0] + except IndexError: return None -- 2.7.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
