passing vars to py scipts in cron jobs

Discussion in 'Python' started by brad, Aug 7, 2007.

  1. brad

    brad Guest

    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
     
    brad, Aug 7, 2007
    #1
    1. Advertising

  2. brad

    Will Maier Guest

    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]-----------------[|http://www.lfod.us/]
     
    Will Maier, Aug 7, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. T

    Timer vs. Cron Jobs

    Mr. T, Jun 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    734
    Hans Kesting
    Jun 9, 2004
  2. Fazer

    Python and cron jobs.

    Fazer, Aug 4, 2003, in forum: Python
    Replies:
    8
    Views:
    857
    Christos TZOTZIOY Georgiou
    Aug 7, 2003
  3. hardikh2000

    JOBs............JOBs............JOBs

    hardikh2000, Aug 16, 2005, in forum: Python
    Replies:
    0
    Views:
    424
    hardikh2000
    Aug 16, 2005
  4. Replies:
    1
    Views:
    432
    Benjamin Niemann
    Sep 18, 2006
  5. Replies:
    1
    Views:
    49
    Chris Angelico
    May 25, 2014
Loading...

Share This Page