I am attempting to take a SHAPEFILE, create separate shapefiles based on specific attributes via split by attributes, adding the separate shapefiles to the map and exporting them to PDF. I am stuck on the last part : adding the shapefiles to the map and exporting them. This is the code that I am using to do this:
workspace = r"C:\Data\NPS"
aprx = arcpy.mp.ArcGISProject(r"C:\Data\NPS\NPSProjTest.aprx")
map = aprx.listMaps()[0]
map.addDataFromPath(workspace)
for lyt in aprx.listLayouts("*"):
lyt.exportToPDF(r"C:\Data\NPS\NPS.pdf", resolution = 300)
I am getting this error code in return:
File "C:\Users\kimve\AppData\Local\Programs\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 1771, in addDataFromPath return convertArcObjectToPythonObject(self._arc_object.addDataFromPath(*gp_fixargs((data_path,), True)))
RuntimeError
Any suggestions? I am not sure what I am doing wrong.