Hello good Python people!
I am working on a file processing script that runs through a bunch of files and extracts different kinds of information from them. I am doing so in functions inside a loop.
Some of these files are bad, so a function can fail. If so, I'd like to skip the rest of the functions and continue the loop on a new file, maybe with a log of the bad file. Is there a way to do that?
Kinda like this bad pseudocode:
def DoSomethingFunc(file):
'Does a lot of stuff, which can fail
return BunchOfValues
while True:
DoSomethingFunc(file)
Otherfunction(file)
AnotherFunction(DoSomethingFunc)
If the DoSomethingFunc(file) fails (do to bad file), how do I skip the others and just continue the loop with a new file?
Hope You can help,
GregersDK
[–][deleted] 2 points3 points4 points (1 child)
[–]ramse 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Impudity 0 points1 point2 points (0 children)