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

Import Project Failure, InvalidLocaleError: Your system's preferred encoding is US-ASCII, but Pants requires UTF-8 #613

Open
alvinhao opened this issue Apr 1, 2021 · 0 comments

Comments

@alvinhao
Copy link

alvinhao commented Apr 1, 2021

I'm getting the following error when trying to load a pants project in IntelliJ. I've tried exporting the locales env variables and it didn't help.
IntelliJ 2020.2.4 Ultimate
Pants Support Plugin 1.16.0

pants --target-spec-file=/private/var/folders/7h/rmwfrbf51xxd6lzbx15njjfh0000gn/T/pants_target_specs1199.in --no-quiet export --output-file=/private/var/folders/7h/rmwfrbf51xxd6lzbx15njjfh0000gn/T/pants_depmap_run456.out --formatted
Exit code: 1

Traceback (most recent call last):
File "/Users/alvin.hao/.cache/pants/setup/bootstrap-Darwin-x86_64/1.14.0/bin/pants", line 11, in
sys.exit(main())
File "/Users/alvin.hao/.cache/pants/setup/bootstrap-Darwin-x86_64/1.14.0/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 85, in main
PantsLoader.run()
File "/Users/alvin.hao/.cache/pants/setup/bootstrap-Darwin-x86_64/1.14.0/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 79, in run
cls.ensure_locale()
File "/Users/alvin.hao/.cache/pants/setup/bootstrap-Darwin-x86_64/1.14.0/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 60, in ensure_locale
""".format(encoding, cls.ENCODING_IGNORE_ENV_VAR)
pants.bin.pants_loader.InvalidLocaleError: Your system's preferred encoding is US-ASCII, but Pants requires UTF-8.
Specifically, Python's locale.getpreferredencoding() must resolve to UTF-8.

Fix it by setting the LC_* and LANG environment settings. Example:
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
Or, bypass it by setting the below environment variable.
PANTS_IGNORE_UNRECOGNIZED_ENCODING=1
Note: we cannot guarantee consistent behavior with this bypass enabled.

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

1 participant