AnsweredAssumed Answered

Script runs fine from command window but not in Server2008 scheduler

Question asked by njcallaghan on Aug 7, 2012
Latest reply on Aug 7, 2012 by njcallaghan
I have the following batch file running every night at 4am.  It does not complete.  However, if I run the command at the command window it runs successfully.  My python script (which follows) seems to run well also.  Please any assistance of getting this running as a scheduled task in Server 2008 would be much appreciated.

Batch file:

rem-----
D:\Python27\ArcGIS10.1\python.exe D:\ArcGISprj\Ciims\geoProccessing\CIIMS_UPDATE.py


Python Script:  Called CIIMS_UPDATE.py referenced in the batch file above

# Import arcpy module
import arcpy

# Local variables:
fcCrossing = "Database Connections\\sdedev.sde\\SDE.CIIMS\\SDE.Static_Crossings"
lyrXYCross = "lyrXYCross"
TblAtlasCrossings = "Database Connections\\SDEDev.sde\\SDE.CIIMS_VWCROSSINGGIS3" #this is a view from CANSYS that exists in the CIIMS Schema
fldLONG="CROSSINGLONGITUDE"
fldLAT="CROSSINGLATITUDE"
PrjLL='GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4326]]'
locklev ="Database Connections\\sdedev.sde"
#CIIMSUser = "SDE" #DisconnectUser will not disconnect the user who is executing the function, so "ALL" is used for now.
#outpath = "Database Connections\\sdedev.sde\\SDE.CIIMS\\"
#outnames = "sde_Static_Crossings"
#SDE_Static_Crossings_1 = "Database Connections\\SDEDev.sde\\SDE.CIIMS\\SDE.Static_Crossings"

arcpy.env.overwriteOutput=True

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(TblAtlasCrossings, fldLONG, fldLAT, lyrXYCross, PrjLL, "")

#to avioud Schema alteration, select and delete the data from the crossing feature class in SDE, Static Crossings
#arcpy.DeleteRows_management (fcCrossing)
#arcpy.DeleteFeatures_Management(fcCrossing)
#for some reason, when we deleteFeatures and remove the locks, we dont see any remaining tablespace for hte Static_Crossings. 
#since its working, we go ahead, disconnect user locks and copy management vs copy_features_Management to copy the event table to the feature class
#remove all the locks
arcpy.DisconnectUser(locklev, "ALL")

#delete the layer of importance fccrossing/static crossings
# Process: Delete
arcpy.Delete_management(fcCrossing, "FeatureClass")

#remove all the locks
arcpy.DisconnectUser(locklev, "ALL")

# Process: Feature To Point
arcpy.FeatureToPoint_management(lyrXYCross, fcCrossing, "INSIDE")

Outcomes