pytest-dev / iniconfig

MIT License
58 stars 31 forks source link

Is class IniConfig support char code option? #44

Closed kou65536 closed 1 year ago

kou65536 commented 2 years ago

I use tox the testing tool for python in Windows 10 enviroment. The problem is that class IniConfig tries to read tox.ini with cp932 encoding. I read the code https://github.com/pytest-dev/iniconfig/blob/master/src/iniconfig/__init__.py#L51 . This not seems to have argument of encoding. Is this possible to set encoding?

tox -c $Env:PROJECT_DIR/tox.ini -e py39
  File "c:\work\reni\git\ogs\.venv\lib\site-packages\py\_vendored_packages\iniconfig\__init__.py", line 54, in __init__
    tokens = self._parse(iter(f))
  File "c:\work\reni\git\ogs\.venv\lib\site-packages\py\_vendored_packages\iniconfig\__init__.py", line 82, in _parse
    for lineno, line in enumerate(line_iter):
UnicodeDecodeError: 'cp932' codec can't decode byte 0x81 in position 115: illegal multibyte sequence