dimanche 15 mars 2020

Having issues with python skipping try statements

I am working on a Python program that is centered around randomly using a function with a few fall backs. For some reason when the program enters the function labeled auto_swipe it does not attempt any of the try statements and slips into the last exception. I have tried using print statements to see if the the try statements pass and I get no output.

Here is the code:

def auto_swipe(self):
    from random import random
    while True:
        sleep(0.5)
        try:
            rand = random()
            if rand < .73:
                self.like()

            else:
                self.dislike()

        except Exception:
            try:
                self.close_popup()
            except Exception:
                self.close_match()

Aucun commentaire:

Enregistrer un commentaire