My main goal is to export a layer from ArcMap as a shapefile and upload it to AGOL. However, I am stuck at this intersection.
All my scripts work in the python console within ArcMap. However, I cannot run the following as a stand-alone script.
#!python2 import os import arcpy # Change Directory os.chdir(r'C:\ \ \ \ArcGIS\Exports') # Export Layer Data arcpy.mapping.MapDocument(r"P:\ \ \*2021.mxd") analysis = arcpy.CopyFeatures_management('Splice Point', r'C:\ \ \ \ArcGIS\Exports\itemSplice.shp') print(analysis) Here is the error I get:
ERROR 000732: Input Features: Dataset Splice Point does not exist or is not supported Failed to execute (CopyFeatures).
It is worth noting that when I run the following code:
import os import arcpy mxd = arcpy.mapping.MapDocument(r"P:\ \ \*2021.mxd") analysis = arcpy.mapping.ListLayers(mxd, None, None) print(analysis) I get a list of layers within the .mxd. One of the listed layers (the one I want), matches the layer mentioned in "CopyFeatures_management."