Compute_rhino3d Object of type zip is not JSON serializable

Using Python 3.7

Reading a file like this

rhFile = rhino3dm.File3dm.Read("TestCurves.3dm")

Then using a compute function with the multiple argument set to true, produces the above mentioned error

curves = [item.Geometry for item in rhFile.Objects if item.Geometry.ObjectType == rhino3dm.ObjectType.Curve]
proj_plane = rhino3dm.Plane.WorldXY()
curves = compute_rhino3d.Curve.ProjectToPlane(curves, [proj_plane for i in range(len(curves))], True)

This seems to be resolved if in the source file compute_rhino3d\
this line if multiple: args = zip(curve, plane)
is changed to if multiple: args = list(zip(curve, plane))

This needs to be changed all over for compatibility with python 3.7?!

Also solving this error this way, throws another error
TypeError: Object of type Plane is not JSON serializable
but this is a problem for rhino3dm I believe, it would be great if you could help with this / take a look @stevebaer ?

I think I fixed the Plane -> JSON issue just last week. Make sure that you are using the lastest rhino3dm from PyPi (0.1.9 at the time of this writing).

We autogenerate the compute api so if we can figure out the best way to zip or list or whatever the inputs we can update everything all at once. I’ll need to look into this to see what works best across all versions of python. Thanks for letting me know about it.

@stevebaer thanks, updating to 0.1.9 solved the Plane problem.

For the other error, I bumped into this simple solution here

	def zip_list(self, *args):
        rv = zip(*args)
        if sys.version_info < (3,0):
            return rv
        return list(rv)

Hi Steve,

I am trying to do something similar here with the Brep.IsPointInside()

I have tried passing the Brep and Points arguments as lists, but keep getting errors. I tried to apply the list(zip()) fix @ SherifTarabishy used to no effect.

Is there a JSON issue for the BREP or Points similar to above. I have updated to 0.1.9.



I’ll take a look Dan

I’ve logged this issue and will hopefully have the clients updated soon

1 Like