Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py : Clarify the encoding when reading a file #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lilacs2039
Copy link

Environment

Windows 10 Pro

Problem

When I tried to pip install the package I created, the following encoding error occured.

Error Message

(Partially abbreviated in ...)

>pip install git+(my library)
Collecting git+(my library)
  Cloning ...
  Running command git clone ...
  Resolved ...
    ERROR: Command errored out with exit status 1:
     command: '...\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\...\\pip-req-build-wpi8iw78\\setup.py'"'"'; ...
         cwd: C:\...
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "...\AppData\Local\Temp\pip-req-build-wpi8iw78\setup.py", line 14, in <module>
        config.read('settings.ini')
      File "...\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 697, in read
        self._read(fp, filename)
      File "...\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 1020, in _read
        for lineno, line in enumerate(fp, start=1):
    UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 250: illegal multibyte sequence
    ----------------------------------------
WARNING: Discarding git+(my library). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Cause

Because the standard input / output of Windows is CP 932, the error occurred while reading a UTF-8 file.

Fixes

Because README.md and settings.ini are in UTF-8 encoding, clarified the encoding when reading the file.

Problem : With the created package, `pip install` fails on Windows
Fixes : Clarified the encoding for file reading.
@lilacs2039 lilacs2039 marked this pull request as ready for review April 4, 2022 11:40
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