flupke / pypotrace

Python bindings for potrace library
Other
165 stars 43 forks source link

TypeError: cannot unpack non-iterable _Point object #44

Open erinrrobinson opened 1 year ago

erinrrobinson commented 1 year ago

Hello,

first, thank you so much for creating this API - it will be enormously useful when I can get it to work. So far I don't think I've had any troubles with installation.

However, when using the sample code

" import potrace import numpy as np

Make a numpy array with a rectangle in the middle

data = np.zeros((32, 32), np.uint32) data[8:32-8, 8:32-8] = 1

Create a bitmap from the array

bmp = potrace.Bitmap(data)

Trace the bitmap to a path

path = bmp.trace()

Iterate over path curves

for curve in path: print("start_point =", curve.start_point) for segment in curve: print(segment) end_point_x, end_point_y = segment.end_point if segment.is_corner: c_x, c_y = segment.c else: c1_x, c1_y = segment.c1 c2_x, c2_y = segment.c2 "

and also when trying to use my own images, I get this error:

Traceback (most recent call last): File "myfile.py", line 69, in end_point_x, end_point_y = segment.end_point TypeError: cannot unpack non-iterable _Point object

Any ideas why this is occuring with the sample code?

GrishTad commented 10 months ago

I have the same problem