Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error in SegmentPlugin.py due to changes in Python 3 #3

Open
marcellillyes opened this issue Apr 8, 2023 · 1 comment
Open

Error in SegmentPlugin.py due to changes in Python 3 #3

marcellillyes opened this issue Apr 8, 2023 · 1 comment

Comments

@marcellillyes
Copy link

marcellillyes commented Apr 8, 2023

Hi Eric,

Thank you for the great software, I am very excited to be using it for my PhD project!

I have noticed an issue in the latest release (v0.5.0) when trying to generate a mesh object, which I believe is due to the change in how Python 3 handles the zip() function and division / operator.

The first problem I ran into was in Line 1429 of the SegmentPlugin.py script:

contours=zip(*segobj.enumContours())[0]

Here I received the following error:
TypeError: 'zip' object is not subscriptable

After reading up about it, it turns out that in Python 2, the zip() function returns a list, while Python 3 returns an iterable object, as described in this thread.

After implementing the solutions described here, the next error occurred in Line 460:

invertring=[midring[(clen/2+i)%clen] for i in range(clen)]

returning the error:
TypeError: list indices must be integers or slices, not float

Again, there has been a change in how Python 3 handles the / operator as discussed here.

I changed the single, true division operator / which returns a float, to a floor division // ,which returns an integer.

After doing this, I was able to generate the mesh object from the segmentation contours.

EDIT: I see now that you have implemented this as well in the experimental branch, but thought logging this would be useful for anyone trying to use this feature.

Cheers and all the best!

Marcell

@ericspod
Copy link
Owner

Hi @marcellillyes, thanks for flagging these issues. I haven't had time to do much with Eidolon in a long while as you see but with the experimental version a lot of these old Python2 issues will be cleaned out.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants