1

I have a script constantly running to check if a race is open or closed. The script finds an open race by Status = OPEN. Then performs steps on it to close it.

The issue is that in the while loop it does the query and outputs data about it. If a race is OPEN and I change status to close it still keeps outputting the information as if it was OPEN.

I have even deleted the whole record during operation and the same output keeps coming out.

I have tried:

  • closing connection after initial query
  • setting every variable in the code to None after first lookup
  • changing database status field from VARCHAR to INT

    def findMarketID(self):
    global market_id
    mycursor = mydbr.cursor()
    mycursor.execute("SELECT market_id FROM horses WHERE status = 'OPEN'")
    myresult = mycursor.fetchall()
    mycursor.close()
    for x in myresult:
        market_id = x
    market_id = str(market_id)
    market_id = market_id.strip(" ('")
    market_id = market_id.strip("',) ")
    if market_id is not None:
      print("There is value")
      time.sleep(2)
    else:
      pass
    while True:
        findMarketID()
    
3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.