0

Being a noob in Python I do not understand why the variable a is not incrementing in this small code...

!/usr/bin/python3

""" Demonstrating APScheduler feature for small Flask App with args """

from apscheduler.schedulers.background import BackgroundScheduler from flask import Flask a = 1 b = "22" def sensor(a,b): """ Function for test purposes. """ a = a + 1 b = "33" print("Scheduler is alive!",a,b)

sched = BackgroundScheduler(daemon=True) sched.add_job(sensor,'interval',seconds=5,args = [a,b]) sched.start() b = "44" print ("final",a,b) app = Flask(name)

@app.route("/") def home(): """ Function for test purposes. """ return "Welcome Home :) ! " + str(a) + " " + b

if name == "main": app.run(debug = True, port = 5000, host= '192.168.1.24')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.