Esri / collector-tools

A set of python scripts and geoprocessing tools to automate common tasks and workflows in conjunction with Collector for ArcGIS
Apache License 2.0
74 stars 35 forks source link

arcpy has no attribute Fail #50

Closed jamesshickey closed 6 years ago

jamesshickey commented 6 years ago

I ran the script "as is" and am receiving an error that says that arcpy has no attribute fail, I change the line in file:add_update_gnss_fields_python_api.py that says arcpy.Fail(e) to print(e) and the script runs but does not update the fields in my arcgis online data. Any ideas why the fields are not added? The feature service is set to editable. Thanks for this script by the way. ArcPro 2.1.2 ArcGIS Desktop 10.5.1 Python - Installed with ArcPro

niti5425-zz commented 6 years ago

@jamesshickey Can you send across the exception? The issue with Fail(e) has been addressed. Thanks for letting us know.

jamesshickey commented 6 years ago

Hi, Thanks for the response. Here is the error I get in ArcGIS Pro: Start Time: Wednesday, April 25, 2018 1:47:23 PM Running script AddGNSSFieldsPythonAPI... Parsing Arguments.. Done parsing arguments.. Signed into organization.. Failed script Add GNSS Metadata Fields (Pro) - Hosted Feature Service... Item does not exist or is inaccessible. Traceback (most recent call last): File "C:\Users\user_name\Documents\ArcGIS\Projects\MyProject2\CollectorUtils\add_update_gnss_fields_python_api.py", line 57, in searchItems_addGNSSMetadataFields featureLayerCollection = FeatureLayerCollection.fromitem(featureLayerItem) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis__init__.py", line 5433, in fromitem if not item.type.lower().endswith('service'): AttributeError: 'NoneType' object has no attribute 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\user_name\Documents\ArcGIS\Projects\MyProject2\CollectorUtils\add_update_gnss_fields_python_api.py", line 434, in searchItems_addGNSSMetadataFields(args_parser) File "C:\Users\user_name\Documents\ArcGIS\Projects\MyProject2\CollectorUtils\add_update_gnss_fields_python_api.py", line 429, in searchItems_addGNSSMetadataFields arcpy.Failed(e) AttributeError: module 'arcpy' has no attribute 'Failed' Failed to execute (AddGNSSFieldsPythonAPI). Failed at Wednesday, April 25, 2018 1:47:30 PM (Elapsed Time: 7.87 seconds)

Thanks, James

jamesshickey commented 6 years ago

Here is the error after updating to the latest version of the scripts: Start Time: Wednesday, April 25, 2018 1:54:27 PM Running script AddGNSSFieldsPythonAPI... Parsing Arguments.. Done parsing arguments.. Signed into organization.. 'NoneType' object has no attribute 'type' Completed script Add GNSS Metadata Fields (Pro) - Hosted Feature Service... Failed to execute (AddGNSSFieldsPythonAPI). Failed at Wednesday, April 25, 2018 1:54:29 PM (Elapsed Time: 2.42 seconds)

How should the Feature Service Item Id look? I have entered both: https://servicesPlace.arcgis.com/Cdds924509asdfk239wWE/arcgis/rest/services/FolderName/FeatureServer and also tried: Cdds924509asdfk239wWE

apulverizer commented 6 years ago

@jamesshickey I believe the id should be the item id of the service, which can be accessed from the item details page of the service:

screen shot 2018-04-25 at 5 03 47 pm
jamesshickey commented 6 years ago

Yes, that is it Thank you Worked perfect once i put the right number in. :grinning: Cheers.