Ignoring an error message to continue with the loop in python [duplicate]

It is generally a bad practice to suppress errors or exceptions without handling them, but this can be easily done like this:

try:
    # block raising an exception
except:
    pass # doing nothing on exception

This can obviously be used in any other control statement, such as a loop:

for i in xrange(0,960):
    try:
        ... run your code
    except:
        pass

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)