I'm automating a workflow that requires outputting a layer package, it throws the general
ERROR 999999 when executing and breaks. It does, however, generate a folder in the correct directory, with the correct name which contains the raw data, but seems to fail when outputting the layer package itself. A snippet of my current code is as follows:
# Generates a feature layer based on previously set args arcpy.MakeFeatureLayer_management(outShp, outName, "", "", "") # Dumby mxd for the output layer to reside mxd = arcpy.mapping.MapDocument("C:\\TEMP\\parser.mxd") dframe = arcpy.mapping.ListDataFrames(mxd) layer = arcpy.mapping.Layer(outName) arcpy.mapping.AddLayer(dframe, layer, "AUTO_ARRANGE") lyrLst = arcpy.mapping.ListLayers(mxd, outName, dframe) layer.description = outName arcpy.PackageLayer_management(lyrLst, outLpk, "PRESERVE", "CONVERT_ARCSDE", "", "ALL", "ALL", "ALL", "", "Footprint", "Bounding") mxd.save()
Not sure what the issue is, other than possible the tool might require somehow 'Analyzing' the data, as it does in the hard coded tool?
I use ArcGIS Desktop 10.1.
Update: Tried using SaveToLayerFile to hard write the layer, and it throws the same error.