adityarathod / pyandoc

Python wrapper for Pandoc—the universal document converter.
https://pypi.python.org/pypi/pyandoc/
MIT License
213 stars 32 forks source link

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

Closed Brianetta closed 8 years ago

Brianetta commented 13 years ago

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?

slestak commented 13 years ago

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']

kennethreitz commented 8 years ago

You have to pass in byte strings in Python 3.