Select to view content in your preferred language

Unable to delete rows via script

1343
2
07-28-2011 09:56 AM
LisaArnold
Deactivated User
Hello,

I am trying to run a Python script on a Windows Server Enterprise 2008, SP2 machine. I am able to successfully run this script from my own machine (Windows 7) but once I move it over to the server the script stalls at the point of arcpy.DeleteRows_management. I thought perhaps there was a permissions issue... This script was generated from a model I built in ArcMap, if I open the model via ArcMap on the server I am able to run the delete rows step. I stepped through running my script, commenting each different action out, when I have it try to do only the delete rows action Idle just hangs and goes to Not Responding. The script is able to do all the other actions, make the event layer, append, compress and analyze. This is the first script I am working with, any advice in troubleshooting this issue is much appreciated.

# Import arcpy module
import arcpy, arcgisscripting


# Local variables:
vw_nm_specimen_latlong_csv = "\\\\GIS\\c$\\TEMP\\vw_nm_specimen_latlong.csv"
GIS_NMBCC = "C:\\Inetpub\\wwwroot\\nmbcc\\python\\GIS_NMBCC@gis.sde\\GIS_NMBCC.GIS_NMBCC.data_nmbcc"
vw_nm_specimen_event = "in_memory\\vw_nm_specimen_event"
sde_connection = "C:\\Inetpub\\wwwroot\\nmbcc\\python\\SDE@gis.sde"

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(vw_nm_specimen_latlong_csv, "declong", "declat", vw_nm_specimen_event, "", "")

# Process: Delete Rows
arcpy.DeleteRows_management(GIS_NMBCC)

# Process: Append
arcpy.Append_management("in_memory\\vw_nm_specimen_event", GIS_NMBCC, "NO_TEST", "specimenid \"specimenid\" true true false 4 Long 0 10 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,specimenid,-1,-1;sciname \"sciname\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,sciname,-1,-1;museumcol \"museumcol\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,museumcol,-1,-1;catnumtxt \"catnumtxt\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,catnumtxt,-1,-1;country \"country\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,country,-1,-1;stateprov \"stateprov\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,stateprov,-1,-1;county \"county\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,county,-1,-1;locality \"locality\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,locality,-1,-1;declat \"declat\" true true false 8 Double 8 38 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,declat,-1,-1;declong \"declong\" true true false 8 Double 8 38 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,declong,-1,-1;georefmet \"georefmet\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,georefmet,-1,-1;vcolldate \"vcolldate\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,vcolldate,-1,-1;latlongcomments \"latlongcomments\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,latlongcomments,-1,-1;originalcoordinatesystem \"originalcoordinatesystem\" true true false 255 Text 0 0 ,First,#,Z:\\TEMP\\vw_nm_specimen_latlong.csv,originalcoordinatesystem,-1,-1", "")

# Process: Compress
arcpy.Compress_management(sde_connection)

# Process: Analyze
arcpy.Analyze_management(GIS_NMBCC, "BUSINESS;FEATURE;ADDS;DELETES")

Tags (2)
2 Replies
JakeSkinner
Esri Esteemed Contributor
What error messages are you receiving?  You can add the try...except block to you code to retrieve the error messages.  Ex:

try:
    arcpy.DeleteRows_management(GIS_NMBCC)
except arcpy.ExecuteError:
    print arcpy.GetMessages()
0 Kudos
SolanaFoo4
Regular Contributor

Having the same issue!  Running against a SQL Express gdb.  I can append to the table but DeleteRows_management hangs indefinitely.  There is no error to catch.

0 Kudos