From 94977917d30caa8729a58c728699d7b95316e49f Mon Sep 17 00:00:00 2001 From: Yo Yehudi Date: Tue, 25 Jun 2019 14:10:42 +0100 Subject: [PATCH] handle new error behaviour in python 3.7 - fixes #40 --- intermine/query.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/intermine/query.py b/intermine/query.py index 39f5e7c1..4bce1288 100644 --- a/intermine/query.py +++ b/intermine/query.py @@ -261,8 +261,8 @@ class Query(object): >>> for row in query.result("", size = ) ... print(row) - - + + Result Processing: Results -------------------------- @@ -475,7 +475,10 @@ def from_xml(cls, xml, *args, **kwargs): def group(iterator, count): itr = iter(iterator) while True: - yield tuple([next(itr) for i in range(count)]) + try: + yield tuple([next(itr) for i in range(count)]) + except StopIteration: + return if q.getAttribute('sortOrder') is not None: sos = Query.SO_SPLIT_PATTERN.split(q.getAttribute('sortOrder')) @@ -1882,4 +1885,3 @@ class QueryParseError(QueryError): class ResultError(ReadableException): pass -