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

tox does not work on my Windows environment due to char-code incorrespondence #3073

Open
kou65536 opened this issue Aug 1, 2023 · 1 comment
Labels
bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@kou65536
Copy link

kou65536 commented Aug 1, 2023

Issue

tox does not work due to try to read with invalid encoding (try to read "UTF-8" but actual encoding is "sjis")

  py39: commands succeeded
  lint: commands succeeded
ERROR:   strictlint: undefined
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\repopath\.venv\Scripts\tox.exe\__main__.py", line 7, in <module>
  File "C:\repopath\.venv\lib\site-packages\tox\session\__init__.py", line 44, in cmdline
    main(args)
  File "C:\repopath\.venv\lib\site-packages\tox\session\__init__.py", line 69, in main
    exit_code = session.runcommand()
  File "C:\repopath\.venv\lib\site-packages\tox\session\__init__.py", line 197, in runcommand
    return self.subcommand_test()
  File "C:\repopath\.venv\lib\site-packages\tox\session\__init__.py", line 225, in subcommand_test
    run_sequential(self.config, self.venv_dict)
  File "C:\repopath\.venv\lib\site-packages\tox\session\commands\run\sequential.py", line 9, in run_sequential
    if venv.setupenv():
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 649, in setupenv
    status = self.update(action=action)
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 282, in update
    self.hook.tox_testenv_install_deps(action=action, venv=self)
  File "C:\repopath\.venv\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "C:\repopath\.venv\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "C:\repopath\.venv\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "C:\repopath\.venv\lib\site-packages\pluggy\_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "C:\repopath\.venv\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 803, in tox_testenv_install_deps
    venv._install(deps, action=action)
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 495, in _install
    self.run_install_command(packages=packages, options=options, action=action)
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 437, in run_install_command
    self._pcall(
  File "C:\repopath\.venv\lib\site-packages\tox\venv.py", line 618, in _pcall
    return action.popen(
  File "C:\repopath\.venv\lib\site-packages\tox\action.py", line 132, in popen
    lines = out_path.read_text("UTF-8").split("\n")
  File "C:\repopath\.venv\lib\site-packages\py\_path\common.py", line 171, in read_text
    return f.read()
  File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 10466: invalid start byte

It worked correctly anyway by change char code literal in the above stacktrace

lines = out_path.read_text("UTF-8").split("\n")

as sjis

lines = out_path.read_text("sjis").split("\n")

Is there any way to specify the literal charcode, or any way to the files be UTF-8 (what files?)?

Environment

Provide at least:

  • OS: Windows 10
Output of pip list of the host Python, where tox is installed

Output of running tox

Output of tox -rvv

Minimal example

@gaborbernat
Copy link
Member

PR welcome.

@gaborbernat gaborbernat added help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. bug:minor does not affect many people or has no big impact labels Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants