NLeSC/Massive-PotreeConverter

Encountering error 'unpack requires a string argument of length 1' during mpc-merge

Opened this issue · 0 comments

When we give custom spacing and levels during PotreeConversion (example spacing 0.5 and levels 5) for different datasets and try to merge their results using mpc-merge, am encountering below error.

Error Stack Trace below:

failed!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pympc/merge_potree_all.py", line 70, in main
run(args.input, args.output, args.move)
File "/usr/local/lib/python2.7/dist-packages/pympc/merge_potree_all.py", line 44, in run
merge_potree.run(octTreeAInputFolder, octTreeBInputFolder, octTreeOutputFolder, moveFiles)
File "/usr/local/lib/python2.7/dist-packages/pympc/merge_potree.py", line 152, in run
joinNode('r', dataA + '/r', dataB + '/r', dataO + '/r', hierarchyStepSize, extension, cmcommand)
File "/usr/local/lib/python2.7/dist-packages/pympc/merge_potree.py", line 49, in joinNode
joinNode(node + childNode, nodeAbsPathA + '/' + childNode, nodeAbsPathB + '/' + childNode, nodeAbsPathO + '/' + childNode, hierarchyStepSize, extension, cmcommand)
File "/usr/local/lib/python2.7/dist-packages/pympc/merge_potree.py", line 18, in joinNode
hrcA = utils.readHRC(nodeAbsPathA + '/' + hrcFile, hierarchyStepSize)
File "/usr/local/lib/python2.7/dist-packages/pympc/utils.py", line 209, in readHRC
data[0].append(getNode(open(hrcFileAbsPath, "rb"), 1, data, True, hierarchyStepSize))
File "/usr/local/lib/python2.7/dist-packages/pympc/utils.py", line 184, in getNode
b = struct.unpack('B', binaryFile.read(1))[0]
error: unpack requires a string argument of length 1

This was because when merging two hrc files at line here the if condition never passes and it ends up writing empty hrc file of size 0 bytes. In the further merge steps above error would occur while merging the empty hrc file with another hrc file. Please let me know if you wanted a sample converted dataset for you to test the merge error above, I would be happy to provide one.