I am attempting to tailor the code found on ESRI's website (https://www.esri.com/arcgis-blog/products/api-python/analytics/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/) to update feature services on our Organization AGOL account. I can't get past this current error message:

enter image description here

Would anyone be willing to look at this code and see if they can find out where I've gone wrong?

enter image description here

  • 3
    Its better if you actually add the code and copy/paste the error message as text. These items are searchable where images are not. Further, the error is when trying to create the .SD file from the CreateWebLayerSDDraft command. I'd try the few lines of code that makes the .SD file inside the Python window of ArcGIS Pro, it might help you troubleshoot – KHibma May 24 '18 at 13:35

I think I see the error in your image. (this is why copy/pasting code is better than the image). From your error screen shot, its failing on the CreateWebLayerSDDraft call.

After FEATURE_ACCESS, make sure that you have a double quote "" (its hard to tell if its a single quote. Single quote is bad).

The very last True, you have a " (quote) after it. Remove that.

arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS','', True, True)
| improve this answer | |
  • That seemed to get me somewhere! I added an additional quote after Feature_Access and removed the one after true. I am now getting this error: Traceback (most recent call last): File "<string>", line 33, in <module> File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\utils.py", line 163, in fn_ arg_name].keys()))) ValueError: Invalid value for service_type: 'FEATURE_ACCESS,' (choices are: ['FEATURE_ACCESS', 'TILED']) – Jeff May 24 '18 at 13:44
  • Any ideas on this one? I can try and add a picture of it if you can't tell from that text. – Jeff May 24 '18 at 13:45
  • If you've copied directly off the blog post - the font used in the code is funky. Try deleting the FEATURE_ACCESS and retyping it with new quotes on it. – KHibma May 24 '18 at 13:46
  • should it look like "FEATURE_ACCESS"" ? – Jeff May 24 '18 at 13:55
  • I am getting a EOL while scanning string literal. Here is the code: # Create a new SDDraft and stage to SD print('Creating SD file') arcpy.env.overwriteOutput = True prj = arcpy.mp.ArcGISProject(prjPath) mp = prj.listMaps()[0] arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS',", True, True) arcpy.StageService_server(sddraft, sd) – Jeff May 24 '18 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.