I'm extracting some paths as border of letters from LateX and I
want to compute the intersection. The problem is that for some reason there is
an empty path extracted which is passed to intersect which is itself passed to
method normsubpath.segments() which doesn't accept empty pathes. Here is the code:
1 2 3 4 5 | |
Here is the precise error message:
Traceback (most recent call last):
File "bug.py", line 11, in <module>
inter1, inter2 = p1.intersect(p2)
File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1692, in intersect
for intersection in zip(*normsubpath_a.intersect(normsubpath_b)):
File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1079, in intersect
closepoints_a = closepoints(self, intersections_a)
File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1037, in closepoints
split = normsubpath.segments([0] + [intersection for intersection, index in intersections] + [len(normsubpath)])
File "/usr/lib/python2.7/site-packages/pyx/normpath.py", line 1255, in segments
segments = self.normsubpathitems[collectindex].segments(collectparams)
IndexError: list index out of range
By the way I get the problem both in PyX 0.12 with Python 2.7.8 and PyX 0.14
Python 3.4.1.
I'm not sure what the correct fix is. For my purpose, I is sufficient to tell
segment to return an empty list if passed an empty path. See two line patch in
attachment. But maybe you want to fix textpath so that in doesn't include this
empty path.
Anyway, thank for the good work !
Florent
fixed by [r3659], closing.
Related
Commit: [r3659]