Okay, here is the workflow: On line 43 import locale, no ImportError is triggered so enter else block on line 46 with name locale_encoding undefined. Run line 48 and ValueError is thrown. error.args is inspected by if block on line 55. In our case the error message is not 'unknown locale: UTF-8' so the contents in if block will not be executed. locale_encoding is still undefined. except block on line 57 is ignored since ValueError has already been captured. locale_encoding is still undefined. Run...
Import block of `utils/error_reporting.py` might cause name error