Select to view content in your preferred language

Error 000732 with ArcPy? Using just a simple Clip_analysis function. Just learning Arcpy

388
1
06-09-2018 05:02 PM
PattyEyster
New Contributor

>>> import arcpy
... from arcpy import env
... env.workspace = "C:\temp"
... infc = "MDroads.shp"
... clipfc = "MC.shp"
... outfc = "MoCoClip.shp"
... arcpy.Clip_analysis(infc, clipfc, outfc)
...
Runtime error Traceback (most recent call last): File "<string>", line 7, in <module> File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\analysis.py", line 62, in Clip raise e ExecuteError: ERROR 000732: Input Features: Dataset MDroads.shp does not exist or is not supported ERROR 000732: Clip Features: Dataset MC.shp does not exist or is not supported
>>>

Tags (1)
0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

You have to learn to use 'raw' formatting for strings of paths in python

"C:\temp"

path = "C:\temp"

print(path)
C:      emp

# ---- hence the path and files don't exist 

\t is the tab … and there are a number of others... hence …..r.... before paths

goodpath = r"C:\temp"

print(goodpath)
C:\temp

or specify workspaces... like

C:/temp …. or C:\\temp