Permalink
Browse files

BF: load/decode README replacing utf-8 in case of the failure

  • Loading branch information...
yarikoptic committed Aug 1, 2017
1 parent a35ee08 commit 6d985b4fd4aa474a36dcd38c2b676d30fd1467fa
Showing with 10 additions and 2 deletions.
  1. +10 −2 setup.py
@@ -66,8 +66,16 @@
__version__ = '0.0.0.dev'
print("Version: %s" % __version__)

with open('README.md') as file:
README = file.read()
# In some environments with too basic locale settings
# it might not be able to read the file with unicode, so we
# would then just ignore the errors
with open('README.md', 'rb') as f:
README = f.read()
# We need to decode it reliably
try:
README = README.decode()
except UnicodeDecodeError:
README = README.decode('ascii', errors='replace')

def find_packages(path, prefix):
yield prefix

0 comments on commit 6d985b4

Please sign in to comment.