From 3916df452f252ef7883ee0ae9753d07fc51b5fe5 Mon Sep 17 00:00:00 2001 From: Pavan Mandava Date: Wed, 29 Jul 2020 19:16:00 +0200 Subject: [PATCH] Added JSONL open check --- utils/reader.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/reader.py b/utils/reader.py index ce606da..c208eac 100644 --- a/utils/reader.py +++ b/utils/reader.py @@ -75,8 +75,9 @@ class DataReaderJsonLines: This method opens the file, reads every line and returns a collection of lines :return: collection of Citation Objects, with the required data """ - for line in jsonlines.open(self.file_path): - yield read_json_line(line) + with jsonlines.open(self.file_path) as jl_reader: + for line in jl_reader: + yield read_json_line(line) def read_json_line(line):