When running a CreateSceneLayerPackage as a standalone script, ArcGIS Pro crashes.
When running the same script in ArcGIS Pro python console, it works fine.
To verify that the problem was not the syntax, I ran the 2 GP tools MakeFeatureLayer and CreateSceneLayerPackage from ArcGIS Pro (not using python, from the toolboxes), I went to the Geoprocessing History > Copy Python Command and copy the lines in my script.
Same thing, when running it from the Pro python console it works, but it crashes from a standalone script.
Has anyone experienced something similar ? Thanks
Do you not get an error message from the script? Is the script editor used by pro to run/edit scripts?
perhaps a fuller example of the script to see what parameters and/or environments need to be looked at
from there, the sample script specifies a workspace and a variety of other options, not the least of which is specifying a workspace in order to use the abbreviated paths to *.lyrx and the *.slpk output. If your environment workspace isn't specified are you using full paths to files on disk? And what the other parameters? and how do they compare to the inputs
import arcpy arcpy.env.workspace = 'c:/gis_data 'arcpy.management.CreateSceneLayerPackage("Denver.lyrx", "Denver.slpk", ["INTENSITY", "RGB", "CLASS_CODE", "FLAGS", "RETURNS"], arcpy.SpatialReference(4326), 0, 0.1, 0.1, ['ITRF_2000_To_WGS_1984 + WGS_1984_To_WGS_1984_EGM2008_2.5x2.5_Height'])
I do not get any error message. A Try: Except: does not catch anything. I directly have the ArcGIS Pro crash report window.
The exact same script works in ArcGIS Pro Python console and crashes when run from Windows cmd or Jupyter Notebook.
The code works from the ArcGIS Pro console.
I have tried using different multipatch feature classes so it should not be the data.
The script is: (copied from ArcGIS Pro Geoprocessing History)
arcpy.management.MakeFeatureLayer(r"D:\workspaces\sandbox\Sandbox_00\Sandbox_00.gdb\MultipatchFC", "MultipatchFC_Layer", None, None, "OBJECTID OBJECTID VISIBLE NONE;Shape Shape VISIBLE NONE")
arcpy.management.CreateSceneLayerPackage("MultipatchFC_Layer", r"D:\workspaces\sandbox\Sandbox_00\SLPK\MultipatchFC.slpk", None, "PROJCS['WGS_1984_Web_Mercator_Auxiliary_Sphere',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator_Auxiliary_Sphere'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],PARAMETER['Auxiliary_Sphere_Type',0.0],UNIT['Meter',1.0]];-20037700 -30241100 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision", 0, 0.01, 0.01, None)
try making and saving a *.lyrx file on disk as in the help topic example... that may be what is crashing Pro, the mix of a layer in Pro versus a layer on disk.
Very good intuition Dan, thanks a lot! Saving the layer on disk is the solution.
I wish I had a little more python trace to debug this.
Thanks again Dan!