My code does not continue at
with self.env.begin(write=False) as txn:
self.keys = [key for key, _ in txn.cursor()]
my output is :
length:  168103
1
my code is :
class LSUNClass(data.Dataset):
def init(self, db_path, base_size=64,
transform=None, target_transform=None):
import lmdb
self.db_path = db_path
self.env = lmdb.open(db_path, max_readers=1, readonly=True, lock=False,
readahead=False, meminit=False)
with self.env.begin(write=False) as txn:
self.length = txn.stat()[‘entries’]
print('length: ', self.length)
cache_file = db_path + ‘/cache’
if os.path.isfile(cache_file):
self.keys = pickle.load(open(cache_file, “rb”))
print(‘Load:’, cache_file, 'keys: ', len(self.keys))
else:
print(“1”)
with self.env.begin(write=False) as txn:
self.keys = [key for key, _ in txn.cursor()]
print(“3”)
pickle.dump(self.keys, open(cache_file, “wb”))
Actually my code is like stopping at
with self.env.begin(write=False) as txn:
self.keys = [key for key, _ in txn.cursor()]
I did not solve this problem.
Have you any idea?