小编And*_*rew的帖子

kwargs/args 错误。将参数传递给 apscheduler 处理函数

将参数传递给 apscheduler 处理函数 这对我来说不起作用,我尝试了不同的语法变体(见下文)。我可能会遗漏一些更基本的东西。

@app.route("/tick", methods=['GET', 'POST'])
def tick(datetimes, texti):
    flash('DO! Sir, you have planned on the {} this:'.format(datetimes), 'success')
    flash(texti, 'info')
    return redirect(url_for('td_list'))

def Schedule_reminders():
    with app.test_request_context():
        if os.environ.get("WERKZEUG_RUN_MAIN") == "true":
            # /sf/ask/661437101/
            scheduler = BackgroundScheduler()
            tds = Td.query.all()
            for td in tds:
                run_date = td.date +' '+ td.time +':00'
                # /sf/ask/868889591/#39027779
                datetimes = run_date
                texti = td.text
                #scheduler.add_job(tick, 'date', [datetimes, texti], run_date)
            # ValueError: dictionary update sequence element #0 has length 1; 2 is required

            #scheduler.add_job(lambda: tick(datetimes, texti), …
Run Code Online (Sandbox Code Playgroud)

python args flask keyword-argument apscheduler

3
推荐指数
1
解决办法
5037
查看次数

标签 统计

apscheduler ×1

args ×1

flask ×1

keyword-argument ×1

python ×1