Fixed #141
The error was cased by the 'None' value of the 'template_path' from

template_dir = os.path.dirname(template_path)