<?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: Python script performing oddly when run as a scheduled task on Windows Server in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71482#M5872</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you look at the path C:\Python27 and see what directories are stored there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There might be 2 - one for 32 bit foreground processing and one for 64 bit background processing (new at v10.1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then check your server's environmental variables and see what the value is PYTHONPATH is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If PYTHONPATH is pointing to the 64 bit version of python (ArcGISx6410.1), this might be the problem as I believe the scheduled task is running the python script in the foreground.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jul 2013 18:58:20 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2013-07-18T18:58:20Z</dc:date>
    <item>
      <title>Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71474#M5864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have setup a python script to run as a scheduled task on a server running Windows Server 2008 (which was ridiculously hard to do in itself).&amp;nbsp; I can run the task manually and it does what it is supposed to do (export a bunch of Data Driven Pages as .pdfs), however it is *not* doing two of the things it is supposed to:&amp;nbsp; 1. Open a console window while it's running, 2. Send an automated email when it is done.&amp;nbsp; Now, if I just manually double-click on the script itself and run it, the command window opens and the email is sent without any issues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does it not do these things when run as a scheduled task?&amp;nbsp; Is there some sort of setting that I need to change?&amp;nbsp; I'm finding scheduled tasks in Server 2008 to be very painful to try to use.&amp;nbsp; I have none of these problems when running the script as a scheduled task in Server 2003.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 03:02:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71474#M5864</guid>
      <dc:creator>JeremyRead</dc:creator>
      <dc:date>2012-03-01T03:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71475#M5865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeremy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also in the process of migrating python scripts from a Windows Server 2003 server to a Windows Server 2008 server.&amp;nbsp; I thought it was going to be a straight forward process, but it has been more difficult than I had expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you call your python scripts from a bat file?&amp;nbsp; That is how I call my python scripts.&amp;nbsp; I did not need to modify the python scripts in the Windows Server 2008 server environment, but I did need to modify my bat files that called the python scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some of the differences in the bat file syntax included:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.) Need to call the python scripts using their full path - I was able to call the script in Windows Server 2003 because it recognized the relative path&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.) Need to call other dependent files (script log files) using their full path&amp;nbsp; - I was able to call the script in Windows Server 2003 because it recognized the relative path&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.) In order to make the bat file code more readable, I set variables for the path to the python script and log files and used these variables to reference the files throughout the bat file (again due to the fact that relative paths to dependent files of the bat file are not recognized)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unlike yourself, my code to generate an E-mail if errors were encountered worked without modification when I moved from Windows Server 2003 server to a Windows Server 2008 server&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 14:25:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71475#M5865</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2012-03-01T14:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71476#M5866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much for your reply.&amp;nbsp; I am not calling the script from a batch file, but maybe that is how I should do it.&amp;nbsp; Could you maybe post an example of how to do this in Server 2008?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I spoke too soon about the automatically-generated email as it is not working at all.&amp;nbsp; However, that may just be something I need to work with our Exchange administrator to resolve.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had actually found an example online to run a Python script as a Windows service and I may still end up going that route.&amp;nbsp; Apparently there are a lot of people out there who are frustrated with the clunkiness of the task scheduler in Server 2008.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 15:24:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71476#M5866</guid>
      <dc:creator>JeremyRead</dc:creator>
      <dc:date>2012-03-01T15:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71477#M5867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeremy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a bat file example that calls a python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;@echo off
set pyexePath="C:\Python26\ArcGIS10.0\python.exe"
set pylogPath="C:\GIS\ServerProcesses\Bezier_Removal\Bezier_Remover_Simplify.log"
set BezRemove_pyPath="C:\GIS\ServerProcesses\Bezier_Removal\01_Bezier_Remover.py"
echo Start time: %time% &amp;gt; %pylogPath%

REM Run the python script
echo ------&amp;nbsp; Update time: %time%
echo ------&amp;nbsp; Removing Bezier curves from RDCL in Transportation GDB&amp;nbsp; --------
echo ------&amp;nbsp; Removing Bezier curves from RDCL in Transportation GDB&amp;nbsp; -------- &amp;gt;&amp;gt; %pylogPath%

%pyexePath% %BezRemove_pyPath% &amp;gt;&amp;gt; %pylogPath%


echo End time: %time% &amp;gt;&amp;gt; %pylogPath%&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the python script that this bat file is calling:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# ---------------------------------------------------------------------------
# Bezier_Remover.py
# Created on: 2011-11-15 15:27:13.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import sys, string, os
import arcpy
import arcpy.mapping
from arcpy import env

import smtplib #E-mail library

# Set environment
arcpy.env.overwriteOutput = True

# Local variables:
RDCL_SRCH__2_ = "RDCL_SRCH"

TRANS_RDCL_SRCH = r"\\Server\GIS\Enterprise\Data\transportation\Transportation.gdb\TRANSPORTATION_RDCL_SRCH"

try:

&amp;nbsp;&amp;nbsp;&amp;nbsp; print("Densifying TRANSPORTATION_RDCL to remove Bezier Curves")

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Process: Densify
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Densify_edit(TRANS_RDCL_SRCH, "DISTANCE", "25 Feet")

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(2)
&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBJECT = "Road Densify Script Failed"
&amp;nbsp;&amp;nbsp;&amp;nbsp; TO = "person@mail.org"
&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM = "Process_Server"
&amp;nbsp;&amp;nbsp;&amp;nbsp; text = "Removal of Bezier Curves in Roads failed" 
&amp;nbsp;&amp;nbsp;&amp;nbsp; BODY = string.join((
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "From: %s" % FROM,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "To: %s" % TO,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Subject: %s" % SUBJECT ,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ), "\r\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp; server = smtplib.SMTP('mail server address',mail server port #) #server = smtplib.SMTP(HOST)
&amp;nbsp;&amp;nbsp;&amp;nbsp; server.sendmail(FROM, [TO], BODY)
&amp;nbsp;&amp;nbsp;&amp;nbsp; server.quit()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a very simple script that I have had running successfully on my Windows Server 2008 server for about 2 months now.&amp;nbsp; The script simply removes Bezier curves from a polyline feature class as the web application that uses this data, fails when working with Bezier curves.&amp;nbsp; I hope this helps you to solve your problem&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:45:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71477#M5867</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-12-10T22:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71478#M5868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks again, Michael.&amp;nbsp; This is very helpful!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Mar 2012 19:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71478#M5868</guid>
      <dc:creator>JeremyRead</dc:creator>
      <dc:date>2012-03-01T19:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71479#M5869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A Python geoprocessing script worked as expected on my Windows 2008 R2 Standard server before upgrading ArcGIS Desktop from 10.0 to 10.1 on that server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, I can't get a Python script to run when I am not logged into the server (selected the option for the task to run whether user is logged in or not when making the task).&amp;nbsp; The script only runs if the task is set up to run only if the user is logged in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I experimented.&amp;nbsp; The problem starts with the import of arcpy.&amp;nbsp; Here is what happened.&amp;nbsp; I scheduled a little script that doesn't use arcpy to write a little text into a text file.&amp;nbsp; That script worked as expected when scheduled with the option to run whether or not the user is logged in.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the tidbit of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; import sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; def make_note(the_note):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file = open(sys.path[0] + "\\test.log", "a")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file.write(the_note)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file.close()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return None&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; make_note("So far, just writing a line.\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, I added an import of arcpy to the script and scheduled the script again.&amp;nbsp; The script stopped executing at the import of arcpy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; def make_note(the_note):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file = open(sys.path[0] + "\\test.log", "a")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file.write(the_note)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; log_file.close()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return None&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; make_note("So far, just writing a line.\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; ***** SCRIPT STOPPED EXECUTING HERE *****&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; make_note("Now...&amp;nbsp; after importing arcpy.")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will note that the ArcGIS license server is on another server.&amp;nbsp; However, the account that I am using can ping that license server okay.&amp;nbsp; This wasn't a problem until after upgrading to 10.1.&amp;nbsp; This is a big problem;&amp;nbsp; It impedes our automation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 17:10:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71479#M5869</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-18T17:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71480#M5870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you upgrade the license server to v10.1?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 17:40:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71480#M5870</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-07-18T17:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71481#M5871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes.&amp;nbsp; I upgrade the license manager to 10.1.&amp;nbsp; Also, ArcGIS Desktop will run on the problematic server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 18:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71481#M5871</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-18T18:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71482#M5872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you look at the path C:\Python27 and see what directories are stored there?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There might be 2 - one for 32 bit foreground processing and one for 64 bit background processing (new at v10.1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then check your server's environmental variables and see what the value is PYTHONPATH is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If PYTHONPATH is pointing to the 64 bit version of python (ArcGISx6410.1), this might be the problem as I believe the scheduled task is running the python script in the foreground.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 18:58:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71482#M5872</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-07-18T18:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71483#M5873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;PYTHONPATH is not the path to Python, simply a place that Python looks for libraries/scripts/modules.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some information on this post might be useful: &lt;/SPAN&gt;&lt;A href="http://pythongisandstuff.wordpress.com/2013/07/10/locating-python-adding-to-path-and-accessing-arcpy/"&gt;locating Python, adding to Path and accessing Arcpy&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2013 22:29:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71483#M5873</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-18T22:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71484#M5874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes.&amp;nbsp; I have both Python 2.7.2 and the Python 2.7.2 64-bit installed to 2 different directories.&amp;nbsp; The Python that is accessed by navigating through [Start | Programs | ArcGIS] is the 64-bit Python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My Path environment variable did not include a path to the folder of the Python.exe of the non-64-bit Python;&amp;nbsp; Path variable did not include a path to the 64-bit Python either.&amp;nbsp; I added the non-64-bit Python path to my Path environment variable.&amp;nbsp; My PYTHONPATH variable was pointing to a custom module folder of an old Python 2.6.x folder.&amp;nbsp; I moved that custom module folder to my non-64-bit Python 2.7.2 installation and set PYTHONPATH accordingly (I don't think that this is a PYTHONPATH issue).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still, same result.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 19:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71484#M5874</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-19T19:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71485#M5875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you using a bat file to call your python script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or are you calling the python script directly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 19:11:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71485#M5875</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-07-19T19:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71486#M5876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes.&amp;nbsp; I tried wrapping the script with a .bat.&amp;nbsp; It did not make a difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 19:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71486#M5876</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-19T19:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71487#M5877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem even remains if I check out an ArcInfo license to this server (as opposed to using the license server, which is remote).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 19:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71487#M5877</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-19T19:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71488#M5878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried switching to the 64-bit Python in the Path environment variable.&amp;nbsp; The problem remained.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 19:44:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71488#M5878</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-19T19:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71489#M5879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ivan:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the Actions tab of your Scheduled Task what do you have as the following entries (Please include full path):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Program/script&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Add arguments (optional)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Start in (optional)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 12:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71489#M5879</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-07-22T12:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71490#M5880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Now the "Arguments" and "Start In" are blank.&amp;nbsp; I did try setting the "Start In" to the full path of the script's folder.&amp;nbsp; That did not make a difference.&amp;nbsp; My script does not use arguments.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 13:27:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71490#M5880</guid>
      <dc:creator>IvanBrown</dc:creator>
      <dc:date>2013-07-22T13:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python script performing oddly when run as a scheduled task on Windows Server</title>
      <link>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71491#M5881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ivan:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the Program/script argument has the path to the bat file including the bat file name?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the Start in (optional) argument has the path to the folder where the above bat file resides?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is how I have my Scheduled Task configured in Windows Server 2008 and it executes successfully.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are running with highest privileges?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 13:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-script-performing-oddly-when-run-as-a/m-p/71491#M5881</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-07-22T13:37:58Z</dc:date>
    </item>
  </channel>
</rss>

