That's strange - the docs seem to say that the db.retrieve
function should return a string, but apparently it does not. In any case, since the print statement gets a useful string out of it, one of these should work:
result.append(str(self.db.retrieve(res,i)))
or
result.append(repr(self.db.retrieve(res,i)))
Just uncomment the #result = list()
line, and add one of the above into the for loop.