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

issue with the locale on windows #47

Open
boubou19 opened this issue Jun 30, 2022 · 1 comment
Open

issue with the locale on windows #47

boubou19 opened this issue Jun 30, 2022 · 1 comment

Comments

@boubou19
Copy link
Member

ran this in the root of the project:

poetry install
poetry run python -m gtnh.cli.update_check
poetry run python -m gtnh.cli.generate_nightly
poetry run python -m gtnh.cli.download_release nightly

got this crash:

Traceback (most recent call last):
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\src\gtnh\cli\download_release.py", line 17, in do_download_release
    await m.download_release(release=release)
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\src\gtnh\modpack_manager.py", line 519, in download_release
    downloaded = [d for d in await asyncio.gather(*downloaders) if d is not None]
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\src\gtnh\modpack_manager.py", line 446, in download_github_mod
    log.info(f"{GREEN_CHECK} Download successful `{mod_filename}`")
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\.venv\lib\site-packages\structlog\_log_levels.py", line 124, in meth
    return self._proxy_to_logger(name, event, **kw)
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\.venv\lib\site-packages\structlog\_base.py", line 204, in _proxy_to_logger
    return getattr(self._logger, method_name)(*args, **kw)
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\.venv\lib\site-packages\structlog\_loggers.py", line 111, in msg
    until_not_interrupted(self._write, message + "\n")
  File "C:\Users\Alexis\Desktop\gtnh modpack\DreamAssemblerXXL\.venv\lib\site-packages\structlog\_utils.py", line 26, in until_not_interrupted
    return f(*args, **kw)
  File "C:\Program Files\Python310\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position 32: character maps to <undefined>

using chcp 65001 before running poetry run python -m gtnh.cli.download_release nightly fixes the issue

@eigenraven
Copy link
Member

Potential workarounds:

If it is enough to replace all unencodable characters with ? in your case then you could set [PYTHONIOENCODING envvar](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING):

T:\> set PYTHONIOENCODING=:replace
T:\> python3 -c "print(u'[\N{EURO SIGN}]')"
[?]

In Python 3.6+, the encoding specified by PYTHONIOENCODING envvar is ignored for interactive console buffers unless PYTHONLEGACYWINDOWSIOENCODING envvar is set to a non-empty string.

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

No branches or pull requests

2 participants