Python Script not running through Task Scheduler on Windows Server 2008

77283
18
05-17-2012 07:11 AM
JennaBernabe1
New Contributor II
I have a python script I am trying to schedule on a server that's operating on Windows Server 2008.  I'm able to get the script to run manually from that server, but when I create a task to start it, there are no results. On the task scheduler window, the task shows that it's running, but there are no outputs or any other indication that it's actually running.

Since the script runs fine when I manually start it, I'm assuming that the problem is within a setting on Task Scheduler or the server itself.  I'm a novice working with scripts and task scheduler, so there might be something I'm overlooking..

Any insight to this problem is appreciated!
Tags (2)
18 Replies
DuncanHornby
MVP Notable Contributor
Jenna,

A quick google search threw up this thread...

Duncan
0 Kudos
MichaelVolz
Esteemed Contributor
I have a few simple suggestions to start with.

1.) Under the General tab, make sure you check Run with highest privileges

2.) Under the Actions tab, make sure you put the path to the python script (or bat file that calls the python script) in the Start in box.

I hope this will solve your problem.
0 Kudos
JennaBernabe1
New Contributor II
Thanks so much for the link to the thread and the suggestions!
I made sure that the highest privileges was checked, and the path to the python script is in the "Start In" box.  I also tried calling the python.exe as the program with the actual script as the argument, but with no luck.
0 Kudos
MichaelVolz
Esteemed Contributor
You might also want to create an Environmental Variable called PYTHONPATH that points to the directory where you python.exe file is located.  Unless I added this Environmental Variable on my Windows Server 2008, I had to include the full path to the .py file and not just the name of the .py file itself.

I also always call my .py files from a bat file.
0 Kudos
JennaBernabe1
New Contributor II
Thanks for the suggestion Michael. I'm not familiar with creating Environmental Variables - but I do call out the full file path names in scheduler. Would creating the environmental variable make a difference if the file paths are listed in scheduler?

My coworker tried running it as a batch program and is getting the same issue where scheduler says it's running, but the script doesn't actually run.
0 Kudos
MichaelVolz
Esteemed Contributor
Can you post the bat file that your co-worker tried to run?
0 Kudos
JennaBernabe1
New Contributor II
Just wanted to give an update - I was able to get the script to run! Turned out, the problem had to deal with the quotations in the Action settings. The argument (script.py) did require quotations, but the program/script (python.exe) and the start in folder did not.

Thanks again for the help!
-jenna
KurtRadamaker
New Contributor II

This was my same issue, I put quotes on the script.py and it worked, Thanks

0 Kudos
BrianO_keefe
Occasional Contributor III
I'm having the same problems and I cannot, for the life of me, get the script to run. I created the script in ModelBuilder and it works fine. I port it to Python and it works fine. But Task Scheduler will not run it... not on a schedule and not by clicking the task and hitting RUN.
0 Kudos