ysbecca/py-wsi

TypeError: a bytes-like object is required, not 'NoneType' while loading loading patches and associated metadata from the lmdb using turtle manager

Arghya999 opened this issue · 1 comments

Vesion : py-wsi 2.0

While loading patches after storing them in a new lmdb database, I am getting "TypeError: a bytes-like object is required, not 'NoneType'" "

code snippet :-

patches, coords, classes, labels = turtle.get_patches_from_file("SB00045509.svs")

ERROR :-

TypeError Traceback (most recent call last)
in
1 #loading patches and associated metadata from the db using turtle manager
----> 2 patches, coords, classes, labels = turtle.get_patches_from_file("SB00045509.svs")

~/ICIAR/py-wsi-master/py_wsi/turtle.py in get_patches_from_file(self, file_name, verbose)
182 else:
183 # LMDB by default.
--> 184 items = self.__get_items_from_file(file_name[:-4])
185 return self.__items_to_patches_and_meta(items)
186

~/ICIAR/py-wsi-master/py_wsi/turtle.py in get_items_from_file(self, file_name)
426 for y
in range(y - 1):
427 for x
in range(x - 1):
--> 428 items.append(get_patch_from_lmdb(txn, x_, y_, file_name))
429 return items
430

~/ICIAR/py-wsi-master/py_wsi/store.py in get_patch_from_lmdb(txn, x, y, file_name)
47 str_id = file_name + '-' + str(x) + '-' + str(y)
48 raw_item = txn.get(str_id.encode('ascii'))
---> 49 item = pickle.loads(raw_item)
50 return item
51

TypeError: a bytes-like object is required, not 'NoneType'

Hi @Arghya999, apologies for the delayed response, I've been unwell. This error indicates that there is no such patch in the LMDB -- I suggest deleting the lmdb file and re-storing the patches