Skip to content

Conversation

iDhanush
Copy link

On Windows systems (e.g. CPython 3.11), pip install membase fails with:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1423: character maps to <undefined>

This is caused by the default open("README.md") using the system encoding (cp1252 on Windows), which breaks when encountering non-ASCII characters.


Fix:
Change:

long_description = open("README.md").read()

to:

long_description = open("README.md", encoding="utf‑8").read()

Impact/Rationale:

  • Ensures consistent behavior across different platforms and locales
  • Prevents read errors during installation
  • Aligns with best practices for packaging: explicitly specifying UTF‑8 for text files ([docs.lucee.org][1], [pyopensci.org][2], [stackoverflow.com][3], [til.simonwillison.net][4])

Verification:
Successfully tested pip install -e . and packaging on Windows with Python 3.11 without errors.


Checklist:

  • Added encoding="utf‑8" to README.md file open call
  • Verified successful installation on Windows & Linux
  • All existing tests pass (if applicable)

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.

1 participant