Skip to content

Commit

Permalink
Fix Python 3.x compatibility for setup.py (#332)
Browse files Browse the repository at this point in the history
Without the patch, setup.py fails to run under Python 3.x with pypandoc installed:

```
Traceback (most recent call last):
  File "setup.py", line 16, in <module>
    f.write(long_description)
TypeError: write() argument must be str, not bytes
```
  • Loading branch information
felixonmars authored and tusharmakkar08 committed Mar 1, 2018
1 parent 4c89902 commit 1821953
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst').encode('utf-8')
with open('README.rst', 'w') as f:
f.write(long_description)
long_description = pypandoc.convert('README.md', 'rst')
with open('README.rst', 'wb') as f:
f.write(long_description.encode('utf-8'))
atexit.register(lambda: os.unlink('README.rst'))
except (ImportError, OSError):
print('WARNING: Could not locate pandoc, using Markdown long_description.')
Expand Down

0 comments on commit 1821953

Please # to comment.