<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script runs fine from command window but not in Server2008 scheduler in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668753#M51896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ensure your script only uses UNC paths not mapped drives, the account you are executing the task as has permissions to access an ArcGIS license and your sde connection file is not using OS authentication.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2012 15:29:11 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2012-08-07T15:29:11Z</dc:date>
    <item>
      <title>Script runs fine from command window but not in Server2008 scheduler</title>
      <link>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668751#M51894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have the following batch file running every night at 4am.&amp;nbsp; It does not complete.&amp;nbsp; However, if I run the command at the command window it runs successfully.&amp;nbsp; My python script (which follows) seems to run well also.&amp;nbsp; Please any assistance of getting this running as a scheduled task in Server 2008 would be much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Batch file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-style: italic; font-family: arial;"&gt;rem-----&lt;BR /&gt;D:\Python27\ArcGIS10.1\python.exe D:\ArcGISprj\Ciims\geoProccessing\CIIMS_UPDATE.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Python Script:&amp;nbsp; Called CIIMS_UPDATE.py referenced in the batch file above&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-style: italic; font-family: arial;"&gt;# Import arcpy module&lt;BR /&gt;import arcpy&lt;BR /&gt;&lt;BR /&gt;# Local variables:&lt;BR /&gt;fcCrossing = "Database Connections\\sdedev.sde\\SDE.CIIMS\\SDE.Static_Crossings"&lt;BR /&gt;lyrXYCross = "lyrXYCross"&lt;BR /&gt;TblAtlasCrossings = "Database Connections\\SDEDev.sde\\SDE.CIIMS_VWCROSSINGGIS3" #this is a view from CANSYS that exists in the CIIMS Schema&lt;BR /&gt;fldLONG="CROSSINGLONGITUDE"&lt;BR /&gt;fldLAT="CROSSINGLATITUDE"&lt;BR /&gt;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]]'&lt;BR /&gt;locklev ="Database Connections\\sdedev.sde"&lt;BR /&gt;#CIIMSUser = "SDE" #DisconnectUser will not disconnect the user who is executing the function, so "ALL" is used for now.&lt;BR /&gt;#outpath = "Database Connections\\sdedev.sde\\SDE.CIIMS\\"&lt;BR /&gt;#outnames = "sde_Static_Crossings"&lt;BR /&gt;#SDE_Static_Crossings_1 = "Database Connections\\SDEDev.sde\\SDE.CIIMS\\SDE.Static_Crossings"&lt;BR /&gt;&lt;BR /&gt;arcpy.env.overwriteOutput=True&lt;BR /&gt;&lt;BR /&gt;# Process: Make XY Event Layer&lt;BR /&gt;arcpy.MakeXYEventLayer_management(TblAtlasCrossings, fldLONG, fldLAT, lyrXYCross, PrjLL, "")&lt;BR /&gt;&lt;BR /&gt;#to avioud Schema alteration, select and delete the data from the crossing feature class in SDE, Static Crossings&lt;BR /&gt;#arcpy.DeleteRows_management (fcCrossing)&lt;BR /&gt;#arcpy.DeleteFeatures_Management(fcCrossing)&lt;BR /&gt;#for some reason, when we deleteFeatures and remove the locks, we dont see any remaining tablespace for hte Static_Crossings.&amp;nbsp; &lt;BR /&gt;#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&lt;BR /&gt;#remove all the locks &lt;BR /&gt;arcpy.DisconnectUser(locklev, "ALL")&lt;BR /&gt;&lt;BR /&gt;#delete the layer of importance fccrossing/static crossings&lt;BR /&gt;# Process: Delete&lt;BR /&gt;arcpy.Delete_management(fcCrossing, "FeatureClass")&lt;BR /&gt;&lt;BR /&gt;#remove all the locks &lt;BR /&gt;arcpy.DisconnectUser(locklev, "ALL")&lt;BR /&gt;&lt;BR /&gt;# Process: Feature To Point&lt;BR /&gt;arcpy.FeatureToPoint_management(lyrXYCross, fcCrossing, "INSIDE")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 14:23:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668751#M51894</guid>
      <dc:creator>NICHOLASCALLAGHAN</dc:creator>
      <dc:date>2012-08-07T14:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script runs fine from command window but not in Server2008 scheduler</title>
      <link>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668752#M51895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;you have the batch file set up as a scheduled task?&amp;nbsp; is there more to it than you are showing? Otherwise, why not just call the python code without embedding it inside the .bat?&amp;nbsp; Perhaps I am missing something?&amp;nbsp; I'm not sure why the .bat wont run in that context though.&amp;nbsp; This screen shot shows how this sort of thing is set up where I am working - we have several services that run on a variety of schedules from every 5 minutes to hourly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 15:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668752#M51895</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-08-07T15:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Script runs fine from command window but not in Server2008 scheduler</title>
      <link>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668753#M51896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ensure your script only uses UNC paths not mapped drives, the account you are executing the task as has permissions to access an ArcGIS license and your sde connection file is not using OS authentication.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 15:29:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668753#M51896</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2012-08-07T15:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script runs fine from command window but not in Server2008 scheduler</title>
      <link>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668754#M51897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;you have the batch file set up as a scheduled task?&amp;nbsp; is there more to it than you are showing? Otherwise, why not just call the python code without embedding it inside the .bat?&amp;nbsp; Perhaps I am missing something?&amp;nbsp; I'm not sure why the .bat wont run in that context though.&amp;nbsp; This screen shot shows how this sort of thing is set up where I am working - we have several services that run on a variety of schedules from every 5 minutes to hourly.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This worked perfectly..... Being fairly new to both, I think i over thought this situation.&amp;nbsp; THANKS for you help!!!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2012 18:41:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-runs-fine-from-command-window-but-not-in/m-p/668754#M51897</guid>
      <dc:creator>NICHOLASCALLAGHAN</dc:creator>
      <dc:date>2012-08-07T18:41:51Z</dc:date>
    </item>
  </channel>
</rss>

