From 80f03c613a63816f8f027b7be96e371d6a0b16d5 Mon Sep 17 00:00:00 2001 From: Pierre Camilleri <22995923+pierrecamilleri@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:02:47 +0200 Subject: [PATCH] fix: remote xlsx file reading with python 3.12 (#1684) - fixes #1642 Adapt to changes of API of `_TemporaryFileWrapper` in python 3.12, unfortunately not intercepted by pyright (see issue for details). The fix does not rely on this class's API, as the value is already stored in a local variable. --- frictionless/formats/excel/parsers/xlsx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frictionless/formats/excel/parsers/xlsx.py b/frictionless/formats/excel/parsers/xlsx.py index b402fdc6d5..591afb79e1 100644 --- a/frictionless/formats/excel/parsers/xlsx.py +++ b/frictionless/formats/excel/parsers/xlsx.py @@ -64,7 +64,8 @@ def read_loader(self): target = tempfile.NamedTemporaryFile(delete=delete) shutil.copyfileobj(loader.byte_stream, target) target.seek(0) - if not target.delete: + + if not delete: control.workbook_cache[path] = target.name # type: ignore atexit.register(os.remove, target.name) # TODO: rebase on using resource without system?