From ca2d9f072f13885e37f483bcea8bb56b0be39678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radom=C3=ADr=20Bos=C3=A1k?= Date: Thu, 9 Mar 2017 20:59:03 +0100 Subject: [PATCH] Fix python2 error in template_explorer.py (#471) If template_explorer.py was imported in python2, it would fail because it uses unicode_literals which would ultimately cause passing an unicode string as the first argument to the 'type' built-in function. This commit fixes this by converting the unicode to string before it is passed to the 'type' function. Fixes #456 --- jrnl/plugins/template_exporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/plugins/template_exporter.py b/jrnl/plugins/template_exporter.py index 6a5fa86b..85aa2236 100644 --- a/jrnl/plugins/template_exporter.py +++ b/jrnl/plugins/template_exporter.py @@ -36,7 +36,7 @@ def __exporter_from_file(template_file): """Create a template class from a file""" name = os.path.basename(template_file).replace(".template", "") template = Template.from_file(template_file) - return type("{}Exporter".format(name.title()), (GenericTemplateExporter, ), { + return type(str("{}Exporter".format(name.title())), (GenericTemplateExporter, ), { "names": [name], "extension": template.extension, "template": template