passing vars to py scipts in cron jobs

Will Maier willmaier at ml1.net
Wed Aug 8 00:02:09 CEST 2007


On Tue, Aug 07, 2007 at 05:45:46PM -0400, brad wrote:
> What's the proper way to call a py script and pass in variables
> while doing cron jobs? I can run the scripts fine from idle,
> python, etc using raw_input() to prompt users. The scripts have
> classes with methods that need arguments. 

This is commonly done with either sys.argv (a list of arguments
passed when invoking the script) or os.environ (a dictionary of
environment variables and values). Use either to instantiate your
classes or run functions.

-- 

[Will Maier]-----------------[willmaier at ml1.net|http://www.lfod.us/]



More information about the Python-list mailing list