framework icon indicating copy to clipboard operation
framework copied to clipboard

Failure with Python 3.12 but not Python 3.11: no attribute 'delete'

Open mcarans opened this issue 6 months ago • 3 comments

I have found an issue with frictionless with Python 3.12 that doesn't occur with Python 3.11. Here is the trace:

../../../.local/share/hatch/env/virtual/hdx-python-utilities/uS5tbIcO/test.py3.12/lib/python3.12/site-packages/frictionless/formats/excel/parsers/xlsx.py:67: in read_loader
    if not target.delete:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tempfile._TemporaryFileWrapper object at 0x7ff2d54ab350>
name = 'delete'

    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
>       a = getattr(file, name)
E       AttributeError: '_io.BufferedRandom' object has no attribute 'delete'

mcarans avatar Feb 15 '24 20:02 mcarans

@roll Just bringing this issue to your attention as I think it will affect anyone reading Excel with frictionless in Python 3.12.

mcarans avatar Feb 20 '24 04:02 mcarans

@roll I tested with frictionless 5.17.0 and unfortunately it doesn't fix this issue

mcarans avatar Apr 29 '24 23:04 mcarans

Thanks @mcarans!

Yea, I know, I think they found the reason in this thread - https://github.com/Tinche/aiofiles/issues/166

cc @pdelboca

roll avatar Apr 30 '24 07:04 roll