Open 10zintopjor opened 1 year ago
The description is a bit unclear... in the case you're looking at, are there existing layer files? If not, it seems quite normal that the layer object is empty
I am passing an already created opf that is downloaded from Openpecha-Data to openpechaFS and it has layers.The main problem is that i need what type of layer exist in a particular opf.
ok yes, then that seems like an issue, can you create a minimal working example demonstrating your bug?
The function returns empty list even though the pecha has layers.
from openpecha.core.pecha import OpenPechaFS
def get_opf_layers(pecha_path):
opf = OpenPechaFS(pecha_path)
opf_layers = opf.layers
return opf_layers
A minimal working example is an example that actually works if I test it but if I run your code nothing will happen. Please provide some code that I can run to reproduce the issue
I have added the MRE in this repo.The main function gets the layer types of opf and then it updates a catalog.
wonderful, thanks!
I can't push code to your repo, but here's a mre.py
that works:
from openpecha.core.pecha import OpenPechaFS
def get_opf_layers(opf_path):
opf = OpenPechaFS(opf_path)
layers = []
for base in opf.meta.bases:
layers = list(opf.get_layers(base))
return layers
if __name__ == "__main__":
pecha_id = "I4AEA9D55"
opf_path = "./I4AEA9D55/I4AEA9D55.opf"
print("opf has %d layers" % len(get_opf_layers(opf_path)))
Is your feature request related to a problem? Please describe. i am trying to get the layers from openpechaFS given a created opf Path to it,however the layers attribute is empty when accessing through the object.
Describe the solution you'd like if the given path is already created,then the layers can be initialise.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context