posativ / acrylamid

(unmaintained) static blog generator in python with incremental rendering ⛺
http://posativ.org/acrylamid/
Other
277 stars 40 forks source link

Jinja2 filter causes failure to compile #221

Closed djwf closed 9 years ago

djwf commented 9 years ago

Adding filters: [Jinja2] to a post's metadata causes compilation to fail with the following error message.

   critical  uncaught exception for content/posts/2011/11/26/12/04/automate-zfs-install-on-nastie-using-mfsbsd/index.md
Traceback (most recent call last):
  File "/usr/sbin/acrylamid", line 9, in <module>
    load_entry_point('acrylamid==0.8.dev0', 'console_scripts', 'acrylamid')()
  File "/usr/lib/python3.4/site-packages/acrylamid/__init__.py", line 164, in Acryl
    commands.compile(conf, env)
  File "/usr/lib/python3.4/site-packages/acrylamid/commands.py", line 140, in compile
    map(HashableList, readers.load(conf))))
  File "/usr/lib/python3.4/site-packages/acrylamid/readers.py", line 68, in load
    entry = Entry(path, conf)
  File "/usr/lib/python3.4/site-packages/acrylamid/readers.py", line 278, in __init__
    i, meta = yamlstyle(fp)
  File "/usr/lib/python3.4/site-packages/acrylamid/readers.py", line 830, in yamlstyle
    props[key] = distinguish(value)
  File "/usr/lib/python3.4/site-packages/acrylamid/readers.py", line 608, in distinguish
    tokens = [unsafe(val.decode('utf-8').strip()) for val in list(tokenizer)]
  File "/usr/lib/python3.4/shlex.py", line 266, in __next__
    token = self.get_token()
  File "/usr/lib/python3.4/shlex.py", line 93, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.4/shlex.py", line 121, in read_token
    nextchar = self.instream.read(1)
AttributeError: 'bytes' object has no attribute 'read'

This is using the most resent git repo (commit 21e0fd8690d5cfee8b8d92d39283b08ab7267b85) installed using sudo pip install git+https://github.com/posativ/acrylamid.git asciimathml pygments on python version 3.4.2 on Arch linux.

Removing the filters: [Jinja2] line removes the error, and compilation works. Please let me know if you need more information.

posativ commented 9 years ago

It is not related to the Jinja2 filter but to the fallback YAML parser. You can temporarily work around this issue by installing PyYAML and let the parser handle the YAML.