The bug is on this line. The exception thrown is not an IOError so the except block doesn't catch it. You are indexing a NoneType when getlocale returns a Null Locale. Were my comments on merge request #110 not taken into consideration? The error still occurs with this update and I think this pull request was merged in haste.