Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > passing vars to py scipts in cron jobs

Reply
Thread Tools

passing vars to py scipts in cron jobs

 
 
brad
Guest
Posts: n/a
 
      08-07-2007
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
 
Reply With Quote
 
 
 
 
Will Maier
Guest
Posts: n/a
 
      08-07-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]-----------------[(E-Mail Removed)|http://www.lfod.us/]
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scipts being blocked on secure site only on some PC's Postilion Computer Support 0 05-16-2007 01:03 AM
JOBs............JOBs............JOBs hardikh2000 Python 0 08-16-2005 03:55 AM



Advertisments