Select to view content in your preferred language

Shapefiles

729
4
08-02-2022 06:43 AM
AlmaRobertson
New Contributor

AlmaRobertson_1-1659447632939.png

Hi I'm working with shapefiles and I'm having trouble in my intro to programming class. The first block of code works, but when I run LN(4) I get error code 000229. I have confirmed the file oil_platforms.shp exists. Any pointers? I feel like I have tried everything to solve this. 

 

Tags (1)
0 Kudos
4 Replies
VinceAngelo
Esri Esteemed Contributor

Please post the code itself, not a picture. Images are not legible on all devices, and would require retying your code to test or recommend a solution.

- V

0 Kudos
AlmaRobertson
New Contributor

Will do in the future. Thank you.

0 Kudos
Brian_Wilson
Honored Contributor

The leading slash in "notebook_path" probably won't work on Windows. It makes it an absolute path and so Windows throws a drive letter in there for you. Z:

You could use a complete path like "C:/Users/YOURLOGINNAMEHERE/arcgis/home/" or it could be relative to the current folder if you leave the leading slash off like just "arcgis/home" if your data is in the local folder.

I use tests a lot like 

import os
if not os.path.exists(notebook_folder): print("THE PATH DOES NOT EXIST!!")

 

0 Kudos
TylerT
by
Frequent Contributor

A handy shortcut to copying paths in Windows is hold shift > right click > copy path.  You will get something like this "C:\temp\some.shp" in your clipboard (even with the quotes).  Because combos of backslashes and characters can be escapes in Python, exercise caution by making a habit of using raw strings by prefixing your path strings with the letter r (e.g. r"C:\temp\input.csv") in your script.

Tyler 

0 Kudos