layout-parser
layout-parser copied to clipboard
TypeError: 'inplace' is an invalid keyword argument for sort()
The documentation at this link is throwing an error .
TypeError: 'inplace' is an invalid keyword argument for sort()
The line which is throwing this error is
right_blocks = [b for b in text_blocks if b not in left_blocks]
right_blocks.sort(key = lambda b:b.coordinates[1], inplace=True)
Basically the sort function which take inplace parameter is layoutparser element as in case of left_block. right_block is a list and list sort dont have inplace parameter.
The right way to do is as follow
right_blocks=sorted(right_blocks,key = lambda b:b.coordinates[1])
Thanks a ton @talhaanwarch, I was looking around the internet for this.