Python Schedule task not running because of arcpy.

Discussion created by tribeiro on May 13, 2013
Latest reply on Sep 23, 2013 by pfoppe
Hi everyone,

I have this really simple Python script, that basically copies a file:
import os, shutil, time
originalSDDraft = "C:\\Esri\\test.sddraft"
localtime = time.localtime(time.time())
filesPath = os.path.dirname(originalSDDraft)
sddraftFile = filesPath + '\\' + str(localtime.tm_min) + str(localtime.tm_sec) + os.path.basename(originalSDDraft).replace('.sddraft','_copy.sddraft')
if os.path.isfile(sddraftFile):

When I run it on a Windows Server 2008 R2 64Bit both through command line and as a scheduled task, it does what it's suppose to do.
When I import the arcpy module, then the "fun" begins. I'm only able to run it as a schedule task if:

  • "Run only when user is logged on" is selected.

  • The user has administrator privileges.

Does any one knows why by just importing the arcpy module the script stops to work as a scheduled task with the option "Run whether user is logged on or not" selected?
Any help would be appreciated!