DOI-USGS / gems-tools-pro

GeMS Tools for ArcGIS Pro
Creative Commons Zero v1.0 Universal
45 stars 15 forks source link

ExecuteError for ValidateGeodatabase in Python #86

Closed masseygeo closed 7 months ago

masseygeo commented 11 months ago

I'm trying to run the ValidateGeodatabase tool (master version, so should be most recent) within a Jupyter Notebook, but keep getting an ExecuteError...not sure if it's due to the scripts or the tool documentation is incorrect? Seems to work fine when run in ArcPro. Other tools work fine (TranslateToShape & GeologicNamesCheck).

# url to usgs gems toolbox (github) master; should be latest version
gems_toolbox_url = r'https://github.com/DOI-USGS/gems-tools-pro/archive/refs/heads/master.zip'

# directory to unzip usgs gems toolbox
# note: filepath can exceed character limit and throw error...using root directory here to mitigate chances of that
gems_toolbox_extract_path = os.path.join(root_dir, 'gems')

# make request to url for latest gems toolbox
with requests.get(gems_toolbox_url) as r:

    # create zipfile object from response
    with ZipFile(BytesIO(r.content)) as z:

        # extract zipfile contents to path
        z.extractall(gems_toolbox_extract_path)

# identify path to toolbox
tbx = str(list(Path(root_dir).rglob("*.tbx" ))[0])

# load usgs gems toolbox into arcpy
arcpy.ImportToolbox(tbx)

arcpy.GEMS.ValidateDatabase(Input_geodatabase=gdb_submission_path, 
                            Output_workspace=gems_toolbox_extract_path, 
                            Metadata_file=md_new, 
                            Validate_embedded_metadata=False, 
                            Skip_topology_checks=False, 
                            Refresh_GeoMaterial_Dict=False, 
                            Delete_unused_Glossary_and_DataSources_rows=True, 
                            Compact_GDB=True, 
                            Open_report_when_done=False)

Output...

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\Desktop\SMtest\SM2023_Deliverables\Millerstown\KY_2023_Millerstown_1-1_ncgmp_submission\gems\gems-tools-pro-master\Scripts\GeMS_ValidateDatabase.py in <module>
   1710         "DuplicatedMU",
   1711     ]
-> 1712     if "DescriptionOfMapUnits" in db_dict:
   1713         dmu_path = db_dict["DescriptionOfMapUnits"]["catalogPath"]
   1714         dmu_map_units_duplicates.extend(guf.get_duplicates(dmu_path, "MapUnit"))

~\Desktop\SMtest\SM2023_Deliverables\Millerstown\KY_2023_Millerstown_1-1_ncgmp_submission\gems\gems-tools-pro-master\Scripts\GeMS_ValidateDatabase.py in main(argv)
   1303         and not v["concat_type"] == "Topology"
   1304     ]
-> 1305     if extras:
   1306         for table in extras:
   1307             schema_extensions.append(

AttributeError: module 'GeMS_utilityFunctions' has no attribute 'eval_bool'

---------------------------------------------------------------------------
ExecuteError                              Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_11800\2734071826.py in <cell line: 3>()
      1 # arcpy.env.workspace=gdb_submission_path
      2 
----> 3 arcpy.GEMS.ValidateDatabase(Input_geodatabase=gdb_submission_path, 
      4                             Output_workspace=gems_toolbox_extract_path,
      5                             Metadata_file=md_new,

~\Desktop\SMtest\SM2023_Deliverables\Millerstown\KY_2023_Millerstown_1-1_ncgmp_submission\gems\gems-tools-pro-master\GeMS_Tools.tbx in ValidateDatabase(Input_geodatabase, Output_workspace, Metadata_file, Validate_embedded_metadata, parameter_5, Skip_topology_checks, Refresh_GeoMaterial_Dict, Delete_unused_Glossary_and_DataSources_rows, Compact_GDB, Open_report_when_done)

~\Desktop\SMtest\SM2023_Deliverables\Millerstown\KY_2023_Millerstown_1-1_ncgmp_submission\gems\gems-tools-pro-master\GeMS_Tools.tbx in ValidateDatabase(Input_geodatabase, Output_workspace, Metadata_file, Validate_embedded_metadata, parameter_5, Skip_topology_checks, Refresh_GeoMaterial_Dict, Delete_unused_Glossary_and_DataSources_rows, Compact_GDB, Open_report_when_done)

C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)
    510         val = getattr(self._gp, attr)
    511         if callable(val):
--> 512             return lambda *args: val(*gp_fixargs(args, True))
    513         else:
    514             return convertArcObjectToPythonObject(val)

ExecuteError: ERROR 000582: Error occurred during execution.
ethoms-usgs commented 9 months ago

Sorry I missed this. Are you still seeing this error?

masseygeo commented 9 months ago

@ethoms-usgs I haven't checked in a while since I couldn't get around this error. I'm gearing up for AGU now, but will get back into it in two weeks with the latest versions and let you know.

masseygeo commented 7 months ago

This appears to be fixed with the latest version!