Skip to content

Commit

Permalink
retrieval: remove unnecessary decode-encode step
Browse files Browse the repository at this point in the history
This should fix MemoryError on attempting encoding
  • Loading branch information
abhidg committed Feb 28, 2022
1 parent 9eb0de1 commit 062d4b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ingestion/functions/retrieval/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def raw_content(url: str, content: bytes, tempdir: str = TEMP_PATH) -> io.BytesI
if f.is_file()),
key=operator.itemgetter(1)
)[0]
with largest_file.open() as fp:
content = fp.read().encode("utf-8")
with largest_file.open("rb") as fp:
content = fp.read()
except subprocess.CalledProcessError as e:
raise ValueError(f"Error in extracting zip file with exception:\n{e}")
Path(f.name).unlink(missing_ok=True)
Expand Down

0 comments on commit 062d4b9

Please sign in to comment.