framework
framework copied to clipboard
TableResource.infer(stats=True) (or system.use_context) have inconsistent behaviour in Windows/Linux
Hello all 👋🏼
I'm experiencing inconsistent behaviour in Windows/Linux when trying to infer metadata. Looks like Windows is not being able to properly calculate bytes and hash values when trying to read from absolute paths.
Any idea what cound be happening?
Thanks!
Linux:
Python 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.31.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from frictionless.resources import TableResource
In [2]: from frictionless import system
In [3]: resource = TableResource(path="./data/plans-barcelona.xlsx")
In [4]: resource.infer(stats=True)
In [5]: print(resource.bytes)
5330227
In [6]: with system.use_context(trusted=True):
...: resource = TableResource(path="/home/pdelboca/Repos/opendataeditor/data/plans-barcelona.xlsx")
...: resource.infer(stats=True)
...: print(resource.bytes)
...:
5330227
Windows:
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.32.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from frictionless.resources import TableResource
In [2]: from frictionless import system
In [3]: resource = TableResource(path='./data/plans-barcelona.xlsx')
In [4]: resource.infer(stats=True)
In [5]: print(resource.bytes)
5330227
In [6]: with system.use_context(trusted=True):
...: resource = TableResource('C:/Users/patricio/Documents/opendataeditor/data/plans-barcelona.xlsx')
...: resource.infer(stats=True)
...: print(resource.bytes)
...:
None