How to publish a feature service to ArcGIS Online from an mxd USING PYTHON?

23580
44
Jump to solution
03-25-2013 07:06 PM
BenoitMetzger
New Contributor II
Hi All,

I would like to automate publishing feature services - from an mxd using Python to my AG Online account.

I did this successfully manually using the menu: Share as -> Service, Publish a service - Feature Access Capabilities etc...

Using Python, I managed to publish the service definition file on AG Online using:
arcpy.mapping.CreateMapSDDraft()
arcpy.mapping.AnalyzeForSD()
arcpy.StageService_server()
arcpy.UploadServiceDefinition_server()

But I could not find a way to publish a feature service to AG Online! I must be missing something. Any help would be really appreciated.

Thanks in advance!
Tags (2)
44 Replies
KevinHibma
Esri Regular Contributor
The compressing error is from when trying to make the .SD file.
I think theres a few things that could cause it.
A couple guesses:
--do you have any locks on the data you're consolidating, or are they accessed by something else? (not allowing them to be put into the sd file)
--you have write access to the directory you're trying to create the .sd in?
--from your screen shot you're executing against 64bit python, but the trace back shows its in 32bit python. Not sure how/why they're crossed. Try running your script from the 32bit Python (note the lack of 'x64' in the path for 32bit).
0 Kudos
KevinBingham
New Contributor II
Kevin-

-- I do not think that there are any locks on the data I am consolidating

-- I do have write access to the directory where I am trying to update that .SD file

-- Previously I tried to execute the script from 32 bit python but received the error "c:\Python27\ArcGIS10.2\python.exe is not a valid Win32 application."

Thanks again,

Kevin
0 Kudos
KevinBingham
New Contributor II
I made it past the last error only to encounter another error related to publishing.  An image (with the error message) is attached.

Thanks,

Kevin
0 Kudos
PhiliposMelake
New Contributor II

Hello

This thread has been so helpful, and i would like to thank all of you in advance for all the information. I am facing similar situation as the original problem. This thread is three year old but i was wondering if there is any solution.

I have ARC 10.3 in my desktop . I am trying to publish mxd file automatically using python script , i used similar code posted in this thread. But it is showing error , unless i signed in manually through the ARCmap it wont publish the map. The error is as follows

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Server: Dataset My Hosted Services does not exist or is not supported
WARNING 001404: You are not signed in to ArcGIS Online.
Failed to execute (UploadServiceDefinition).

0 Kudos
GisGKAuckland
New Contributor III

Can you please post is as a file  or text with line breaks included?

Not an expert with Phyton

0 Kudos