NeurodataWithoutBorders / lindi

Linked Data Interface (LINDI) - cloud-friendly access to NWB data
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

repr error #86

Open bendichter opened 3 months ago

bendichter commented 3 months ago
import json
import lindi

# URL of the remote .nwb.lindi.json file
url = 'https://lindi.neurosift.org/dandi/dandisets/000939/assets/56d875d6-a705-48d3-944c-53394a389c85/nwb.lindi.json'

# Load the h5py-like client for the reference file system
# in read-write mode
client = lindi.LindiH5pyFile.from_lindi_file(url, mode="r+")

client.keys()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File /opt/miniconda3/lib/python3.12/site-packages/IPython/core/formatters.py:711, in PlainTextFormatter.__call__(self, obj)
    704 stream = StringIO()
    705 printer = pretty.RepresentationPrinter(stream, self.verbose,
    706     self.max_width, self.newline,
    707     max_seq_length=self.max_seq_length,
    708     singleton_pprinters=self.singleton_printers,
    709     type_pprinters=self.type_printers,
    710     deferred_pprinters=self.deferred_printers)
--> 711 printer.pretty(obj)
    712 printer.flush()
    713 return stream.getvalue()

File /opt/miniconda3/lib/python3.12/site-packages/IPython/lib/pretty.py:411, in RepresentationPrinter.pretty(self, obj)
    408                         return meth(obj, self, cycle)
    409                 if cls is not object \
    410                         and callable(cls.__dict__.get('__repr__')):
--> 411                     return _repr_pprint(obj, self, cycle)
    413     return _default_pprint(obj, self, cycle)
    414 finally:

File /opt/miniconda3/lib/python3.12/site-packages/IPython/lib/pretty.py:779, in _repr_pprint(obj, p, cycle)
    777 """A pprint that just redirects to the normal repr function."""
    778 # Find newlines and replace them with p.break_()
--> 779 output = repr(obj)
    780 lines = output.splitlines()
    781 with p.group():

File /opt/miniconda3/lib/python3.12/site-packages/h5py/_hl/base.py:388, in KeysViewHDF5.__str__(self)
    387 def __str__(self):
--> 388     return "<KeysViewHDF5 {}>".format(list(self))

File <frozen _collections_abc>:849, in __len__(self)

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File /opt/miniconda3/lib/python3.12/site-packages/h5py/_hl/group.py:494, in Group.__len__(self)
    491 @with_phil
    492 def __len__(self):
    493     """ Number of members attached to this group """
--> 494     return self.id.get_num_objs()

AttributeError: 'str' object has no attribute 'get_num_objs'
bendichter commented 3 months ago

(found in an effort to address #85)