From 56e49a7031d6b9de450149fcbeb79d3e810b8beb Mon Sep 17 00:00:00 2001 From: chfw Date: Mon, 14 Aug 2017 22:18:09 +0100 Subject: [PATCH 1/2] use iget_array to reduce memory footprint. and removed useless imports because they are loaded when required by pyexcel and lml --- app/utils.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/utils.py b/app/utils.py index a0c8747e6..16f759aeb 100644 --- a/app/utils.py +++ b/app/utils.py @@ -22,10 +22,6 @@ from flask import ( ) from flask_login import current_user import pyexcel -import pyexcel_io -import pyexcel_xls -import pyexcel_xlsx -import pyexcel_ods3 from notifications_utils.template import ( SMSPreviewTemplate, @@ -246,12 +242,16 @@ class Spreadsheet(): return cls(Spreadsheet.normalise_newlines(file_content), filename) if extension == 'tsv': - file_content = StringIO(Spreadsheet.normalise_newlines(file_content)) + file_content = StringIO( + Spreadsheet.normalise_newlines(file_content)) - return cls.from_rows(pyexcel.get_sheet( - file_type=extension, - file_content=file_content.read() - ).to_array(), filename) + instance = cls.from_rows( + pyexcel.iget_array( + file_type=extension, + file_stream=file_content), + filename) + pyexcel.free_resources() + return instance def get_help_argument(): From 886fb2bb3cfc598ac45b2528228afb298e0e715a Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 17 Aug 2017 23:52:34 +0100 Subject: [PATCH 2/2] :bug: fix the broken test by replacing a buggy depdency ezodf v0.3.2 with pyexcerl-ezodf v0.3.2. More info can be found here: https://github.com/pyexcel/pyexcel-ezodf/issues/1. The package name change reason can be found here: https://github.com/pyexcel/pyexcel-ezodf/issues/2. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index da227e796..ce3919089 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ pyexcel==0.5.3 pyexcel-io==0.4.4 pyexcel-xls==0.4.0 pyexcel-xlsx==0.4.1 -pyexcel-ods3==0.4.0 +pyexcel-ods3==0.4.1 pytz==2017.2 six==1.10.0 gunicorn==19.7.1