Skip to content

Explicitly specify the encoding while reading the readme file.#5

Open
abhipec wants to merge 1 commit into
guillaumegenthial:masterfrom
abhipec:patch-1
Open

Explicitly specify the encoding while reading the readme file.#5
abhipec wants to merge 1 commit into
guillaumegenthial:masterfrom
abhipec:patch-1

Conversation

@abhipec

@abhipec abhipec commented Feb 1, 2019

Copy link
Copy Markdown

Since the readme file contains a Unicode character, on some systems such as docker container when the terminal encoding is not proper, the setup fails with the following error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 300: ordinal not in range(128)

The error is generated while reading the readme file in setup.py

This pull request will resolve this issue. The proposed solution is tested for Python 2.7 and Python 3.5.

Comment thread setup.py

with open("README.md", "r") as fh:
long_description = fh.read()
with open("README.md", "rb") as fh:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should specify the encoding directly in the open() call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants