AnsweredAssumed Answered

Module library and Windows Scheduler

Question asked by lmwood on Jul 25, 2012
Latest reply on Jul 25, 2012 by clthompson
Hi I am trying to set up a few scripts to run automatically daily and would like some input on what would be the best approach with python 2.6.5.
Right now my scripts run fine from command line and IDLE and have their own library which I use the os and sys modules to locate the directory. As long as they are on a base directory this works fine.
But because scheduler is run from C:/Windows/system32 the modules and the base directory is then lost. of course if I hard code this is works fine as well but these must be transportable to another system easily so I do not have to change 50 scripts every time I want to move them.
How can I dynamically run this from scheduler without having to put my Library in the python module library and run from Windows scheduler? Or is there another approach such as the KRONOS module to run something daily that may work better for this? I have around 50 different scripts that run daily at different times. Previously they were run with on a unix system in aml's using CRON jobs.
Any advice is appreciated! 

This is what I am using now...

import sys, os, string, datetime, calendar, time, gzip, traceback, shutil, arcpy
from os.path import splitdrive
from arcpy import env
from arcpy.sa import *
path = os.getcwd()
(drive, tail) = splitdrive(path)
lib = os.path.join(drive +'/aml_py/lib')
sys.path.append(lib)
import julian, zips

Outcomes