How to add parameter for function in add_job()

7,709 views
Skip to first unread message

MJo

unread,
Sep 24, 2014, 8:21:36 AM9/24/14
to apsch...@googlegroups.com
Hi, newbie here,

scheduler.add_job(do_your_thing, 'interval', "parameter_for_do_your_thing_function", seconds=30)

produces: ValueError: The list of positional arguments is longer than the target callable can handle (allowed: 1, given in args: 3)

How to pass parameters for do_your_thing function?

Alex Grönholm

unread,
Sep 24, 2014, 9:40:44 AM9/24/14
to apsch...@googlegroups.com
To pass positional arguments to your callable, put them in the "args" argument. For further information, check the API documentation.
--
You received this message because you are subscribed to the Google Groups "APScheduler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apscheduler...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MJo

unread,
Sep 24, 2014, 2:18:06 PM9/24/14
to apsch...@googlegroups.com


On Wednesday, September 24, 2014 4:40:44 PM UTC+3, Alex Grönholm wrote:
To pass positional arguments to your callable, put them in the "args" argument. For further information, check the API documentation.

Of course, thank you!

scheduler.add_job(do_your_thing, 'interval', args=['parameter_for_do_your_thing_function'], seconds=30)

will do
Reply all
Reply to author
Forward
0 new messages