2

I'm having issues with ArcGIS Pro crashing when I run this ArcPy code directly into ArcGIS Pro Python window. I previously wrote the three lines separately but I decided to try to copy python code from Geoproccessing history. However the outcome is the same where ArcGIS Pro Crashes. Specifically, the trailing dots freeze, and the program freezes and the below image pops-up. There is no error code thrown, just a Windows Program 'has stopped working' as seen below

Does it have something to do with how I'm storing or not storing the data?

The code is supposed to select some attributes, copy it to a new layer, and dissolve that new layer. They seem to work individually when run.

Error Message

import arcpy

arcpy.env.workspace = 'c:\data\python.gdb'

arcpy.management.SelectLayerByAttribute("SHAPE_START", "NEW_SELECTION", "LEASE_NAME LIKE 'ABC%'", None)

arcpy.management.CopyFeatures("SHAPE_START", r"C:\Data\GIS\Project\Python\Python.gdb\INPUT_SHAPE_SELECTION", None, None, None, None)

arcpy.management.Dissolve("INPUT_SHAPE_SELECTION", r"C:\Data\GIS\Project\Python\Python.gdb\FINAL_OUTPUT", None, None, "MULTI_PART", "DISSOLVE_LINES")

I am using ArcGIS Pro 2.2.4 on Windows 10 using the ArcGIS Pro Python Window

2
  • 1
    Even though you are not utilising this assignment in your given code; arcpy.env.workspace = 'c:\data\python.gdb' will not be interpreted as you expect, it should be arcpy.env.workspace = r'c:\data\python.gdb' -defining your path as raw string literal. Also, I suggest you to look at result object.
    – fatih_dur
    Dec 10, 2019 at 7:03
  • @user2856 Thanks for this. I do keep the copy features as I need the original polygons for potential future use, and use the dissolve for something else. Thanks for the info though.I tried running lines 1-3 together but get a crash as well.
    – oveedRX
    Dec 10, 2019 at 18:56

1 Answer 1

2

I think you are confusing ArcGIS Pro with where it should look for its data. At the moment you are setting a current workspace (using arcpy.env.workspace), providing full pathnames to feature classes in another workspace, and giving it "SHAPE_START" which it may try to interpret as a layer name.

Try this, and I would expect that error to disappear. I am assuming that SHAPE_START is a layer in your map.

import arcpy
arcpy.management.SelectLayerByAttribute("SHAPE_START", "NEW_SELECTION", "LEASE_NAME LIKE 'ABC%'", None)
arcpy.management.CopyFeatures("SHAPE_START", r"C:\Data\GIS\Project\Python\Python.gdb\INPUT_SHAPE_SELECTION", None, None, None, None) 
arcpy.management.Dissolve(r"C:\Data\GIS\Project\Python\Python.gdb\INPUT_SHAPE_SELECTION", r"C:\Data\GIS\Project\Python\Python.gdb\FINAL_OUTPUT", None, None, "MULTI_PART", "DISSOLVE_LINES")
2
  • The code is right, but I think there is something wrong / needed between line 1 & 2. Running the code lines individually seems to work, as well running line 2+3 together seems to work if I manually make a selection. Running Line 2 individually works as well.
    – oveedRX
    Dec 10, 2019 at 1:19
  • Lines 1,3 Run together also freeze.
    – oveedRX
    Dec 10, 2019 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.