Problem with shapefile export (Ghshp) - KeyNotFoundException - Python

Hello!

I’m trying to export some geometry with attributes to a shapefile. The plugin used is the Ghshp (https://www.food4rhino.com/app/ghshp). Unfortunately, it appears this error:

Runtime error (KeyNotFoundException): KeyError

Traceback:
line 238, in write_many, “< string >”
line 253, in script

I can’t tell what is wrong. Anyone to help? The GH file is attached.

Thank you in advance,
Kevin

exporting shp problem.gh (148.3 KB)

Judging from the code, the error seems to be produced by a missing or corrupt shp file. You have to provide an absolute/full filepath to the path input. Instead of using metahopper, why don’t you just use a standard Path (File Path) component to set your path?

1 Like

It still doesn’t work. The sollution that I found was to use another component, BearGIS

The export component works well, even it exports all data in string format. But it’s good enough.

Anyway, thanks!!

Hi Kevin, any chance you could share your procedure of exporting a .shp? I’ve tried both Ghshp and BearGIS and failed miserably. The same error pops up for me with Ghshp and BearGIS fails to collect data. I’m hoping to be able to manipulate a shapefile within Rhino and export it to .shp for further GIS analysis. Importing isn’t an issue, but exporting seems impossible.

Of course, Sara. By the way, I made it to work with ghshp component, that’s great because the shapefile structure works better.

Here is a gh file showing an export: example of ghshp shp export.gh (2.9 MB)

The main work is to get the tree paths’ structure right.

Hope it helps.

Thank you so much, Kevin. I ended up using BearGIS, as I just couldn’t get ghshp to export properly, but your tip about tree structures and your .gh file were extremely helpful so once again, thank you! I’ll post my procedure below, in case anyone stumbles upon the same issue in the future.
shp_exporting.gh (403.9 KB)

1 Like