I'm trying to share/publish an mxd using a python script, and starting by using CreateMapSDDraft.
When I run the script I get "Value Error" followed by the path to the ArcGIS server: 'C:\Users\paa-admin\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\arcgis on paa-server_6080 (admin).ags'
When I run my script (using PyScripter) with ArcMap opened using NPLC.mxd, I get an error stating "Cannot get exclusive schema lock. Either being edited or in use by another application". This indicates to me that the path is valid.
I've looked at http://desktop.arcgis.com/en/arcmap/10.4/analyze/arcpy-mapping/createmapsddraft.htm
I've also looked at https://community.esri.com/thread/185559-value-error-createmapsddraft, which helped me identify that I should be using the full path.
The following is a code snippet, the key line being
con = 'C:\Users\paa-admin\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\arcgis on paa-server_6080 (admin).ags'
with the error coming from
analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER',
con, True, None, summary, tags)
Any suggestions are most appreciated! I'm a Python newbie so I apologize in advance if this is an obvious error on my part!!
#Now share NPLC as a service
# define local variables
wrkspc = r"C:\\Users\\paa-admin\\Documents\\MapsandGeodatabase\\"
mapDoc = arcpy.mapping.MapDocument(wrkspc + 'NPLC.mxd')
con = 'C:\Users\paa-admin\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\arcgis on paa-server_6080 (admin).ags'
service = 'NPLC'
sddraft = wrkspc + service + '.sddraft'
sd = wrkspc + service + '.sd'
summary = 'PNational Parcel Layer Content'
tags = 'parcel'
# create service definition draft
analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER',
con, True, None, summary, tags)