Select to view content in your preferred language

Python and Publishing to AGO for Organisations and My Hosted Services does not exist

3669
3
03-14-2013 03:34 PM
PeterTimmers
Frequent Contributor
I've got a bit of python that is publishing (or rather overwriting) data regularly to AGO and it works while ArcMap is open but doesn't while ArcMap isn't.   I am signing in to the portal in the code.

I get.
ERROR 000732: Server: Dataset My Hosted Services does not exist or is not supported

Here is a sample of my code - slightly censored.

print "Signing in to Portal"
arcpy.SignInToPortal_server("login", "password", "http://www.arcgis.com/")

# Process: Stage Service
arcpy.StageService_server("file.sddraft", "file.sd")

# Process: Upload Service Definition
arcpy.UploadServiceDefinition_server("file.sd", "My Hosted Services", "ServiceName", "", "FROM_SERVICE_DEFINITION", "", "STARTED", "USE_DEFINITION", "NO_SHARE_ONLINE", "PRIVATE", "NO_SHARE_ORGANIZATION", "")
Tags (2)
0 Kudos
3 Replies
ErikEndrulat
Regular Contributor
I'm having the same problem with 10.2, but am able to successfully publish/overwrite feature services using 10.1.  Which version are you using? Here's a link to the the thread I posted to.
0 Kudos
PeterTimmers
Frequent Contributor
I think (and this post was in March - so I might be wrong) it ended up being "user error". 

I'd created the SD in ArcMap and went to publish in python - with ArcMap shut.

I had to create the SD in python and then it worked.
0 Kudos
NathanHeickLACSD
Frequent Contributor

If you ended up here, you should check out this blog post if you are using ArcGIS 10.2 or greater.  The moral of the story is that the SignInToPortal tool can no longer be used to login to ArcGIS Online from a stand alone Python script.  If you have ArcMap or ArcCatalog open when you run the script, it works.  Otherwise, you get the error that My Hosted Services does not exist or is not supported.

Instead, to make the script completely standalone, you have to use the ArcGIS REST API to update the feature service.  They have a script with a configuration file that organizes the process for you.

0 Kudos