I have had this work regularly before but for some reason, since the update to 10.5 I think but I cant say for sure, the UploadServiceDefinition tool isn't working consistently when I want to send something to AGOL. I haven't changed anything in the code and everything runs fine until that last step. I have tried logging in to AGOL in ArcMap and saving the map docs, signing in and leaving ArcMap open, and even running the script from within ArcMap while signed in. I just checked help(arcpy.UploadServiceDefinition_server) to make sure the docs didn't change at 10.5 without me noticing. server_type is set to 'MY_HOSTED_SERVICES' when creating the draft definition. It worked a couple weeks ago but now isnt.. Any ideas?
arcpy<SPAN class="punctuation token">.</SPAN>UploadServiceDefinition_server<SPAN class="punctuation token">(</SPAN>in_sd_file <SPAN class="operator token">=</SPAN> finalSD<SPAN class="punctuation token">,</SPAN>
in_server <SPAN class="operator token">=</SPAN> <SPAN class="string token">"My Hosted Services"</SPAN><SPAN class="punctuation token">,</SPAN>
in_service_name <SPAN class="operator token">=</SPAN> mapDoc<SPAN class="punctuation token">,</SPAN>
in_cluster <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN>
in_folder_type <SPAN class="operator token">=</SPAN> <SPAN class="string token">"EXISTING"</SPAN><SPAN class="punctuation token">,</SPAN>
in_folder <SPAN class="operator token">=</SPAN> <SPAN class="string token">"OpenData"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Gives me an error:
Failed to execute<SPAN class="punctuation token">.</SPAN> Parameters are <SPAN class="operator token">not</SPAN> valid<SPAN class="punctuation token">.</SPAN>
ERROR <SPAN class="number token">000732</SPAN><SPAN class="punctuation token">:</SPAN> Server<SPAN class="punctuation token">:</SPAN> Dataset My Hosted Services does <SPAN class="operator token">not</SPAN> exist <SPAN class="operator token">or</SPAN> <SPAN class="keyword token">is</SPAN> <SPAN class="operator token">not</SPAN> supported
Failed to execute <SPAN class="punctuation token">(</SPAN>UploadServiceDefinition<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>