Errors versus warnings: There's a big difference
As with Python in general, the main difference between errors and warnings is that warnings do not cause a program to terminate. Errors do. Warnings provide notice of something we should note; errors indicate the reason the program cannot continue. If not handled appropriately, warnings therefore pass process information to the user without interrupting the execution of the program. This lack of detectability makes warnings more dangerous to the security of an application, and the system in general, than errors. Consequently, the error-handling process of an application must account for both errors and warnings.
While Python handles warnings and exceptions differently by default, especially with regard to program execution, both are written to stderr
. Therefore, one handles them the same way that one handles standard errors (see Handling exceptions passed from MySQL in the later sections).
Additionally, one can set warnings to be silenced altogether...