AnsweredAssumed Answered

Python standalone script using ArcGIS Pro license

Question asked by jyi67 on Sep 6, 2018
Latest reply on Sep 6, 2018 by jyi67

Hi,

I am writing some standalone code following the link KML To Layer—Conversion toolbox | ArcGIS Desktop (KMLToLayer example 2 (stand-alone script)) to try to convert a list of .KMZ files to .lyrx files, using ArcGIS Pro license. The sample .kmz file I used is attached. It can be opened from Google Earth. 

My testing code is as simple as this:

 

import arcpy
import os

# Set workspace (where all the KMZs are)
arcpy.env.workspace = r"C:\Work\Google_MASHUP\AdministrativeBoundary\ParkTest"

# Set local variables and location for the consolidated file geodatabase
out_location = r"C:\Work\ArcGIS_Layers_From_KMZ"

# Convert all KMZ and KML files found in the current workspace
for kmz in arcpy.ListFiles("*.km*"):
    print("CONVERTING: {0}".format(os.path.join(arcpy.env.workspace, kmz)))
    arcpy.KMLToLayer_conversion(kmz, out_location)

 

I got the error: 

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input KML File: Dataset Dinosaur.kmz does not exist or is not supported
Failed to execute (KMLToLayer).

 

The printed result is: 

CONVERTING: C:\Work\Google_MASHUP\AdministrativeBoundary\ParkTest\Dinosaur.kmz, which is correct.

 

I am able to use the Geoprocessing tool KML to Layer directly from ArcGIS Pro window to convert the .KMZ successfully but not from the above code. 

 

Also, using the same code, with ArcGIS Server License, I am able to run it successfully. 

 

Could anybody give the suggestions on this error?

 

Thanks

JYI

Attachments

Outcomes