I have installed yapf
and the PyYapf
package (https://github.com/jason-kane/PyYapf) for sublime text for Python code formatting. Furthermore, for my Python projects I'm using pipenv
.
When executing the formatting command in sublime I receive the following error
Traceback (most recent call last):
File "~/.pyenv/versions/3.6.8/bin/pipenv", line 10, in <module>
sys.exit(cli())
File "~/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "~/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 696, in main
_verify_python3_env()
File "~/.pyenv/versions/3.6.8/lib/python3.6/site-packages/pipenv/vendor/click/_unicodefun.py", line 124, in _verify_python3_env
' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
I have now tried the suggestion to use the two above exports and set them globally in my profile (and reboot). Opening a terminal and checking they seem to be available:
$printenv | grep "C.UTF-8"
LC_ALL=C.UTF-8
LANG=C.UTF-8
However, sublime text still gives the original error. Looking at the source of the package the environment is read in like this inside the PyYapf.py
package:
self.popen_env = os.environ.copy()
When printing the content of self.popen_env
then the LANG
and LC_ALL
don't seem to be set or not to the C.UTF-8
value.
Where is sublime text getting the envs from?
from Sublime Text environment variables not present
No comments:
Post a Comment