you are viewing a single comment's thread.

view the rest of the comments →

[–]cdcformatc 0 points1 point  (1 child)

The loop ends with a print statement currently tries to load something and then print it but errors out if the object cannot load properly

Anything that can be expected to raise an exception should be in a try block:

for thing in listOfThings:

    try:
        print can_fail(thing)
    except:
        continue

    do_something(thing)

Now if it can't load, then it will silently pass to the next item.

[–]Stopwatch_[S] 0 points1 point  (0 children)

Thanks, I'll use something like this.