1
0
Fork 0
forked from github/pelican

Merge pull request #874 from avaris/non-ascii-error

Handle critical exception logging correctly in localized systems
This commit is contained in:
Justin Mayer 2013-05-04 08:35:01 -07:00
commit 2482baf837

View file

@ -378,7 +378,13 @@ def main():
pelican.run()
except Exception as e:
logger.critical(e)
# localized systems have errors in native language if locale is set
# so convert the message to unicode with the correct encoding
msg = str(e)
if not six.PY3:
msg = msg.decode(locale.getpreferredencoding(False))
logger.critical(msg)
if (args.verbosity == logging.DEBUG):
raise