We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecf5673 commit a06d894Copy full SHA for a06d894
pysenal/io/file.py
@@ -320,6 +320,8 @@ def __change_mode(self, mode):
320
self._file = open(self.filename, mode, encoding=self.encoding)
321
322
def _to_read(self):
323
+ if not os.path.exists(self.filename):
324
+ raise FileNotFoundError(self.filename)
325
self.__change_mode('r')
326
327
def _to_write(self):
@@ -403,6 +405,13 @@ def read_line(self):
403
405
for line in self._file:
404
406
yield json.loads(line)
407
408
+ def read_lines(self, skip_empty=False, *args, **kwargs):
409
+ self._to_read()
410
+ items = []
411
+ for line in self._file:
412
+ items.append(json.loads(line))
413
+ return items
414
+
415
def write(self, data):
416
super().write(data)
417
0 commit comments