adityarathod/pyandoc

Python 3 uses unicode, and is not compatible with subprocess pipes

Closed this issue · 2 comments

I'm using pyandoc inside a Python 3 CGI script. I'm having to convert strings in the following manner to avoid getting an exception from Python:

doc.markdown = "This is a *really* simple example".encode('latin-1')

print(doc.html.decode('UTF-8'))

Failure to do this causes some messy (and difficult to understand) errors and an aborted script. Perhaps this should be handled explicitly, or at least caught and explained?

This appears to affect python 2.7.2 as well.

update:
I see my problem, you have PANDOC_PATH hardcoded in core.py.

['/Users/kreitz/.cabal/bin//pandoc', '--from=markdown', '--to=rst']

You have to pass in byte strings in Python 3.