1
Python and Java API / Duplicate element keys not allowed
« on: June 17, 2019, 12:18:43 PM »
When I run a metashape python script I receive this warning message "Duplicate element keys not allowed", the third time I receive a runtime error with the same message (this happen when the masks are imported). About 50% of the time the script is running without problems, in other cases it stopped running because of this error. Any ideas?
An extract of the script I am running:
doc = Metashape.app.document
doc.save(os.path.join(pathtmp, docname))
doc.read_only = False
# create chunk and load images
chunk = doc.addChunk()
image_list1 = sorted(glob.glob(os.path.join(pathinput1, '*.png')))
chunk.addPhotos(image_list1)
image_list2 = sorted(glob.glob(os.path.join(pathinput2, '*.png')))
chunk.addPhotos(image_list2)
chunk.importMasks(source=Metashape.MaskSourceAlpha,operation=Metashape.MaskOperationReplacement)
An extract of the script I am running:
doc = Metashape.app.document
doc.save(os.path.join(pathtmp, docname))
doc.read_only = False
# create chunk and load images
chunk = doc.addChunk()
image_list1 = sorted(glob.glob(os.path.join(pathinput1, '*.png')))
chunk.addPhotos(image_list1)
image_list2 = sorted(glob.glob(os.path.join(pathinput2, '*.png')))
chunk.addPhotos(image_list2)
chunk.importMasks(source=Metashape.MaskSourceAlpha,operation=Metashape.MaskOperationReplacement)