Add additional debug logic for reading templating files

Ref #5776
Make the `except` less general
Merge pull request #5794 from basepi/unicode5776

Add additional debug logic for reading templating files