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 supportedHere 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", "")