Select to view content in your preferred language

Geoprocessing tool, throughs error, ERROR 000732: Output Geodatabase: Dataset does not exist or is not supported

1039
2
02-03-2024 11:02 PM
User35489
Frequent Contributor

Hi,

Environment: ArcGIS Pro 3.2.1, ArcGIS Enterprise 11.1

I published a geoprocessing tool which converts AutoCAD .dwg file to .geojson format.
When i try to run it from WebApp Builder or Portal Map viewer classic, It throughs below error.

It worked fine on ArcGIS Pro desktop, with no issues

"

Traceback (most recent call last): File "", line 99, in execute File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\conversion.py", line 2169, in CADToGeodatabase raise e File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\conversion.py", line 2166, in CADToGeodatabase retval = convertArcObjectToPythonObject(gp.CADToGeodatabase_conversion(*gp_fixargs((input_cad_datasets, out_gdb_path, out_dataset_name, reference_scale, spatial_reference), True))) File "C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Output Geodatabase: Dataset
C:\Users\PRODGI~1\AppData\Local\Temp\tmp2vw9kb42
\\networkfiles\location\arcgisserver\directories\arcgissystem\arcgisinput\others\Tool1.GPServer\extracted\p30\..\cd\shapefile_datatemp.gdb does not exist or is not supported Failed to execute (CADToGeodatabase). Failed to execute (DWGtoGEOJSON_Stage1). Failed.

"

 

# -*- coding: utf-8 -*-

import arcpy
import os
import tempfile
import os.path
import shutil

class Toolbox:
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "toolbox"
        self.alias = "toolbox"

        # List of tool classes associated with this toolbox
        self.tools = [Tool]


class Tool:
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "DWGtoGEOJSON_Stage1"
        self.description = ""

    def getParameterInfo(self):
        """Define the tool parameters."""
        params = [
            arcpy.Parameter(displayName="Input_CAD_File",
                            name="in_cad",
                            datatype="DEFile",
                            parameterType="Required",
                            direction="Input"),
            arcpy.Parameter(displayName="Output GEOJSON File",
                            name="out_geojson",
                            datatype="DEFile",
                            parameterType="Required",
                            direction="Output")
        ]
        return params

    def isLicensed(self):
        """Set whether the tool is licensed to execute."""
        return True

    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""
        return

    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter. This method is called after internal validation."""
        return

    def execute(self, parameters, messages):
        """The source code of the tool."""
        in_cad = parameters[0].valueAsText
        out_geojson = parameters[1].valueAsText

        temp_dir = tempfile.mkdtemp()
        temp_gdb = "temp.gdb"

        arcpy.CreateFileGDB_management(temp_dir, temp_gdb)
        arcpy.env.workspace = os.path.join(temp_dir, temp_gdb)

        # Execute Create FileGDB, temp

        arcpy.CreateFileGDB_management(temp_dir, temp_gdb)

        #####################################

        # Process: CAD to Geodatabase
        arcpy.CADToGeodatabase_conversion(in_cad, temp_dir+'//'+temp_gdb, "FClass", "1000", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 11258999068426.2;-1073.7418235 4194304001953.12;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision")

        #####################################

        # Process: Iterate Feature Classes

        datasets = arcpy.ListDatasets(feature_type='feature')
        datasets = [''] + datasets if datasets is not None else []

        for ds in datasets:
            for fc in arcpy.ListFeatureClasses(feature_dataset=ds):
                path = os.path.join(arcpy.env.workspace, ds, fc)
                print(path)
                arcpy.FeaturesToJSON_conversion(fc, out_geojson, "FORMATTED", "NO_Z_VALUES", "NO_M_VALUES", "GEOJSON")
        #####################################

        # Process: Features To JSON
##        arcpy.FeaturesToJSON_conversion(fc, out_geojson, "FORMATTED", "NO_Z_VALUES", "NO_M_VALUES", "GEOJSON")

        #####################################

        # Execute Delete FileGDB

        #arcpy.Delete_management(newpath)        
##        return

    def postExecute(self, parameters):
        """This method takes place after outputs are processed and
        added to the display."""
        return

 

 

0 Kudos
2 Replies
CodyPatterson
Frequent Contributor

Hey @User35489 

Looking through the error message and through the code you provided, I believe that it works through the Desktop application due to the program being able to create a gdb through the local PC. It may be experiencing roadblocks due to running through an online service unable to create certain files.

In my opinion, I'd first attempt to place some print or return functions throughout that show what certain data is, and also keep the File Explorer open to observe the creation of the gdb. I imagine there is a step that is occurring that isn't hit at all, specifically maybe this here:

\\networkfiles\location\arcgisserver\directories\arcgissystem\arcgisinput\others\Tool1.GPServer\extracted\p30\..\cd\shapefile_datatemp.gdb

Isn't being created possibly?

Hope it points you in the right direction!

Cody

MyriamFischer
Occasional Contributor

Not sure if you solved this issue, but I just found out that path names with a point (Tool1.GPServer) in the string have given me this error when running for example the geoprocessing copy tool. This occurs in ArcGIS Pro 3.2 and not before. It's the same when you run the tool in python. I'm currently searching for other users with the same problem. I'm not sure if ESRI is aware of this.

0 Kudos