Fixes #6412 - More details about template loader.

Report more details about template files in loader postmortem.
Use StringIO from utils.six compat. wrapper