Small-Bodies-Node / pds4_tools

Python package to read and display NASA PDS4 data.
17 stars 13 forks source link

TypeError: 'NoneType' object is not callable when reading a TableDelimited in debug mode with pandas in dept #90

Closed mmebsout closed 3 months ago

mmebsout commented 11 months ago

Context:

I have Pycharm in MacOsX running a test with pytest in debug mode.

def test_reading_pds4():
    product = pds4_tools.read( "./my_product.xml")

Works fine

Whereas :

import pandas
pandas.DataFrame()
def test_reading_pds4():
    product = pds4_tools.read( "./my_product.xml")

raises :

../venv/lib/python3.10/site-packages/pds4_tools/reader/core.py:198: in pds4_read
    structures = read_structures(label, filename, lazy_load=lazy_load, no_scale=no_scale,
../venv/lib/python3.10/site-packages/pds4_tools/reader/core.py:309: in read_structures
    structure.data
../venv/lib/python3.10/site-packages/pds4_tools/extern/cached_property.py:86: in __get__
    return obj_dict.setdefault(name, self.func(obj))
../venv/lib/python3.10/site-packages/pds4_tools/reader/table_objects.py:363: in data
    read_table_data(self, no_scale=self._no_scale, decode_strings=self._decode_strings, masked=self._masked)
../venv/lib/python3.10/site-packages/pds4_tools/reader/read_tables.py:955: in read_table_data
    table_structure.data = new_table(extracted_fields, no_scale=no_scale, decode_strings=decode_strings,
../venv/lib/python3.10/site-packages/pds4_tools/reader/read_tables.py:730: in new_table
    table_structure.data = np.recarray(num_records, dtype=dtypes).view(array_type)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

subtype = <class 'numpy.recarray'>, shape = 44
dtype = [('INSTRUMENT_ID', dtype('<U4')), ('UNIT_ID', dtype('<U1')), ('PDS4_TARGET_LID', dtype('<U56')), ('PDS4_TARGET_NAME', dtype('<U10')), ('PDS4_TARGET_TYPE', dtype('<U17')), ('VISIBILITY_START', dtype('<U24')), ...]
buf = None, offset = 0, strides = None, formats = None, names = None
titles = None, byteorder = None, aligned = False, order = 'C'

    def __new__(subtype, shape, dtype=None, buf=None, offset=0, strides=None,
                formats=None, names=None, titles=None,
                byteorder=None, aligned=False, order='C'):

        if dtype is not None:
>           descr = sb.dtype(dtype)
E           TypeError: 'NoneType' object is not callable

../venv/lib/python3.10/site-packages/numpy/core/records.py:423: TypeError

my_product.zip

LevN0 commented 11 months ago

Thank you for reporting. I was not able to replicate this on Windows 10.

What version of OSX did you experience this? What was the version of NumPy? Can you test in a different environment?

mmebsout commented 4 months ago

Hello, sorry for the late reply. I tried reproducing it again but couldn't, sorry.

LevN0 commented 3 months ago

Thank you for the update.