kneufeld/consolemd

UnicodeDecodeError: 'ascii' codec can't decode byte ...

Closed this issue · 2 comments

$ git config remote.orgin.url
https://github.com/pi-hole/pi-hole.git

$ file README.md
README.md: HTML document, UTF-8 Unicode text, with very long lines

$ consolemd README.md
Traceback (most recent call last):
File "/usr/local/bin/consolemd", line 11, in
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/consolemd/cli.py", line 147, in cli
renderer.render( md, **kw )
File "/usr/local/lib/python2.7/dist-packages/consolemd/renderer.py", line 52, in render
ast = self.parser.parse( md )
File "/usr/local/lib/python2.7/dist-packages/commonmark/blocks.py", line 898, in parse
self.incorporate_line(lines[i])
File "/usr/local/lib/python2.7/dist-packages/commonmark/blocks.py", line 847, in incorporate_line
self.add_line()
File "/usr/local/lib/python2.7/dist-packages/commonmark/blocks.py", line 620, in add_line
self.tip.string_content += (self.current_line[self.offset:] + '\n')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 12: ordinal not in range(128)

Thank you for taking the time to make this issue. The problem is that you're running consolemd on python 2 instead of python 3. I just verified that I can correctly view the readme from pi-hole.

Here's an excerpt from consolemd's README.md

Due to the inexorable tides, ConsoleMD is now Python3 only. If things happen to work in Python2 then super great, but that is no longer a requirement.

Thanks - turns out there's two pip's in Ubuntu 18.04: python-pip and python3-pip.

To install correctly it needs to use pip3 install consolemd after apt install python3-pip