Quick Import will always try to create a new file geodatabase and the scratch GDB already exists, try using another name and make sure it doesn't exist before running Quick Import.
Thanks BruceHarold for suggestion.
I tried by giving a new gdb name but no luck.
My guess is Quick Import's input data type is not supported in the geoprocessing framework so you can try making an embedded Spatial ETL tool that accepts a file input. However a workspace (geodatabase) output is not supported by server side geoprocessing, so you will need to write to a zipped file geodatabase and make its path an output.
I looked into this and I've narrowed down the problem. I think the parameters somehow get mangled when inputted into the tool by gp_fixargs.
Here's a very basic python tool to test this issue:
# -*- coding: utf-8 -*-
import arcpy
import os
import traceback
from pathlib import Path
class Toolbox(object):
def __init__(self):
self.label = "Toolbox"
self.alias = "toolbox"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
params = [
arcpy.Parameter(
displayName="Input file",
name="input_file",
direction="Input",
parameterType="Required",
datatype="DEFile"
)
]
return params
def isLicensed(self):
return True
def updateParameters(self, parameters):
return
def updateMessages(self, parameters):
return
def execute(self, parameters, messages):
arcpy.env.overwriteOutput = True
ext_status = arcpy.CheckExtension("DataInteroperability")
if ext_status != "Available":
arcpy.AddError(f"Data Interoperability status: {ext_status}")
else:
arcpy.AddMessage("Data interoperability available")
arcpy.CheckOutExtension("DataInteroperability")
kmlPath = parameters[0].valueAsText
arcpy.AddMessage(f"Input file: {kmlPath}")
if not os.path.exists(kmlPath):
arcpy.AddMessage("Source file doesn't exist")
return
arcpy.AddMessage("File contents:")
with open(kmlPath, 'r') as file:
for row in file.readlines():
arcpy.AddMessage(row)
arcpy.AddMessage("")
output_dir = arcpy.env.scratchFolder
if not os.path.exists(output_dir):
arcpy.AddMessage("Creating destination folder")
Path(output_dir).mkdir(parents=True, exist_ok=True)
output_gdb = os.path.join(output_dir, "export.gdb")
arcpy.AddMessage(f"Output gdb: {output_gdb}")
try:
res = arcpy.interop.QuickImport(
Input=kmlPath,
Output=output_gdb
)
arcpy.AddMessage(str(res))
except Exception as e:
arcpy.AddMessage(traceback.format_exc())
def postExecute(self, parameters):
return
And here's a very simple test file to reproduce the error with (test.geojson):
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}
Parameters used to publish webtool:
Messages when running locally:
Data interoperability available
Input file: C:\Users\_____\_____\Documents\ArcGIS\Projects\QuickImport\test.geojson
File contents:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}
Output gdb: C:\Users\_____\_____\Documents\ArcGIS\Projects\QuickImport\scratch\export.gdb
C:\Users\_____\_____\Documents\ArcGIS\Projects\QuickImport\scratch\export.gdb
Messages when running published as Web Tool:
Data interoperability available
Input file: D:\arcgisserver\directories\arcgisjobs\quickimporttesttool_gpserver\ja6af2726b46a455296ce7e438a7d2492\scratch\test.geojson
File contents:
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1]
},
"properties": {
"name": "Dinagat Islands"
}
}
Output gdb: D:\arcgisserver\directories\arcgisjobs\quickimporttesttool_gpserver\ja6af2726b46a455296ce7e438a7d2492\scratch\export.gdb
Traceback (most recent call last):
File "<string>", line 84, in execute
File "d:\arcgis\server\framework\runtime\arcgis\Resources\arcpy\arcpy\interop.py", line 103, in QuickImport
raise e
File "d:\arcgis\server\framework\runtime\arcgis\Resources\arcpy\arcpy\interop.py", line 100, in QuickImport
retval = convertArcObjectToPythonObject(gp.QuickImport_interop(*gp_fixargs((Input, Output), True)))
File "d:\arcgis\server\framework\runtime\arcgis\Resources\arcpy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (QuickImport).
The root cause seems to be version incompatibility between ArcGIS Pro and the ArcGIS Enterprise environment where the tool is published. The code provided above works without issues in a more recent AE environment.