passing vars to py scipts in cron jobs

B

brad

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. Here's an example... I want to run c1.d1(v,v,v) then
c2.d2(v,v,v)

class c1:
# User defined vars
def d1(var1, var2, var3):
pass

class c2:
# User defined vars
def d2(var1, var2, var3):
pass

Thanks,
Brad
 
W

Will Maier

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top