blogofile icon indicating copy to clipboard operation
blogofile copied to clipboard

macos blogofile.template:Error rendering template: permapage.mako

Open ghost opened this issue 12 years ago • 6 comments

smart@smarttekiMacBook-Pro ~/Sites % blogofile init mysite blog !219 blog plugin site_src files written to mysite

smart@smarttekiMacBook-Pro ~/Sites % blogofile build -s mysite !220 ERROR:blogofile.template:Error rendering template: permapage.mako

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/template.py", line 157, in render rendered = self.mako_template.render(*_self) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/template.py", line 412, in render return runtime.render(self, self.callable, args, data) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 766, in _render *_kwargs_for_callable(callable, data)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 798, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 824, in exec_template callable(context, _args, *_kwargs) File "_templates/base.mako", line 2, in render_body ${next.body()} File "_templates/site.mako", line 20, in render_body ${next.body()} File "_templates/blog/permapage.mako", line 2, in render_body <%include file="post.mako" args="post=post" /> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 693, in include_file callable(ctx, *_kwargs_for_include(callable, context._data, *_kwargs)) File "_templates/blog/post.mako", line 18, in render_body

| categories: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

ERROR:blogofile:Fatal build error occured, calling bf.config.build_exception() Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/bin/blogofile", line 9, in load_entry_point('Blogofile==0.8b1', 'console_scripts', 'blogofile')() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/main.py", line 58, in main args.func(args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/main.py", line 388, in do_build writer.write_site() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/writer.py", line 49, in write_site self.run_controllers() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/writer.py", line 162, in __run_controllers controller.run_all(namespaces) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/controller.py", line 229, in run_all c.mod.run() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/blogofile_blog-0.8b1-py2.7.egg/blogofile_blog/site_src/_controllers/blog/__init.py", line 80, in run permapage.run() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/blogofile_blog-0.8b1-py2.7.egg/blogofile_blog/site_src/_controllers/blog/permapage.py", line 12, in run write_permapages() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/blogofile_blog-0.8b1-py2.7.egg/blogofile_blog/site_src/_controllers/blog/permapage.py", line 38, in write_permapages "permapage.mako", bf.util.path_join(path, "index.html"), env) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/plugin.py", line 160, in materialize_template lookup=self.template_lookup, caller=self.module) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/template.py", line 388, in materialize_template template.render(location) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Blogofile-0.8b1-py2.7.egg/blogofile/template.py", line 157, in render rendered = self.mako_template.render(**self) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/template.py", line 412, in render return runtime.render(self, self.callable, args, data) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 766, in _render **kwargs_for_callable(callable, data)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 798, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 824, in exec_template callable(context, _args, *_kwargs) File "base_mako", line 23, in render_body File "site_mako", line 41, in render_body File "permapage_mako", line 35, in render_body File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Mako-0.7.2-py2.7.egg/mako/runtime.py", line 693, in include_file callable(ctx, *_kwargs_for_include(callable, context._data, *_kwargs)) File "post_mako", line 49, in render_body UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

ghost avatar Jul 28 '13 15:07 ghost

Before running blogofile build, set the language with export LANG=en_US.UTF-8 (or export LANG=C)

crayxt avatar Apr 06 '14 07:04 crayxt

@crayxt I have the same issue and the LANG envvar is properly set (in my case it's pt_BR.UTF-8).

iuriguilherme avatar Jul 22 '14 03:07 iuriguilherme

Same issue of #136, #138, #141, #147 and #152

iuriguilherme avatar Aug 04 '14 03:08 iuriguilherme

@iuriguilherme I meant always set language to en_US.UTF-8 or C, sorry for being unclear

crayxt avatar Aug 04 '14 03:08 crayxt

@crayxt I have got your point already. Here is what I have:

$ export LANG=C; blogofile build
Traceback (most recent call last):
  File "/usr/lib/python2.6/logging/__init__.py", line 799, in emit
    stream.write(fs % msg.encode("UTF-8"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 78: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/local/bin/blogofile", line 9, in <module>
    load_entry_point('Blogofile==0.7.1', 'console_scripts', 'blogofile')()
  File "/usr/local/lib/python2.6/dist-packages/blogofile/main.py", line 135, in main
    args.func(args)
  File "/usr/local/lib/python2.6/dist-packages/blogofile/main.py", line 201, in do_build
    writer.write_site()
  File "/usr/local/lib/python2.6/dist-packages/blogofile/writer.py", line 52, in write_site
    self.__run_controllers()
  File "/usr/local/lib/python2.6/dist-packages/blogofile/writer.py", line 136, in __run_controllers
    controller.run_all()
  File "/usr/local/lib/python2.6/dist-packages/blogofile/controller.py", line 203, in run_all
    controller.run()
  File "_controllers/blog/__init__.py", line 25, in run
    blog.posts = post.parse_posts("_posts")
  File "_controllers/blog/post.py", line 328, in parse_posts
    src = open(post_path, "r").read().decode(
UnicodeEncodeError: 'ascii' codec can't encode characters in position 37-39: ordinal not in range(128)

Same result with

$ export LANG=C && blogofile build

iuriguilherme avatar Aug 12 '14 01:08 iuriguilherme

@iuriguilherme sorry for confusion. I have migrated to other static blog generator since then, cannot help.

crayxt avatar Aug 12 '14 02:08 crayxt