J
J
JRBRO2022-04-04 10:17:40
Python
JRBRO, 2022-04-04 10:17:40

How to skip individual loops in Python?

Hello. There is automation that works through loop. If on any of the circles something does not go according to plan, he immediately throws it out and everything has to be done all over again. How can I get around this so that each circle is independent, so to speak?

aList = open("info.csv", "r")
bList = open("name.csv", "r")
for a,b in zip(aList, bList):
    print(a)
    print(b)
    try:
        driver.get(a)
        driver.maximize_window()
        time.sleep(20)
    except TimeoutException:
        continue

driver.quit()


I figured out the transition to the next one, you just need to add input and it will be on click, but how to avoid crash in case of an error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kadabrov, 2022-04-04
@JRBRO

except TimeoutException:
        continue

replace to catch all errors
except Exception as e:
            print(e)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question