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
Call of export.sh in bash will end with an error, when $LANG is set (to non-english) (IDFGH-5432) #7173
Comments
@happenpappen Thank you for reporting the issue. RuntimeError is caused because of the way the click library is parsing the bash version. We contacted click developers and proposed a solution. Now we are waiting for the response. We will also publish a workaround soon. |
For those in need of quick workaround, it's possible to get it working by modifiing two lines in shell_completion.py, on line 305: output = subprocess.run(["bash", "-c", "echo $BASH_VERSION"], stdout=subprocess.PIPE)
match = re.search(r"(\d)\.(\d)\.\d", output.stdout.decode()) It requires echo command, but I haven't seen anything with bash without echo yet, so I think it should be universal. |
There's already a patch pull request to click pallets/click#1942. |
it seems to be not fixed in the current ESP-IDF 4.3 ? right ? |
but i can confirm, using the Patch from 23.06 works ... |
@franz-ms-muc v4.3.1 released 18 days ago contains the fix. |
This happens for python 3.9.
Occurs regardless of the version of ESP-IDF. I changed shell_completion.py:
|
Environment
git describe --tags
to find it):v4.3
v4.4-dev-1594-g1d7068e4b
xtensa-esp32-elf-gcc --version
to find it):xtensa-esp32-elf-gcc (crosstool-NG esp-2020r3) 8.4.0
Problem Description
When sourcing the export.sh file with ". ./export.sh" the script will fail in bash, when $LANG is set to non-english. I tried this on Ubuntu 21.04 with $LANG set to "de_DE.UTF-8". The error stack is:
$ . ./export.sh
Detecting the Python interpreter
Checking "python" ...
Python 3.9.5
"python" has been detected
Adding ESP-IDF tools to PATH...
Using Python interpreter in /home/cs/.espressif/python_env/idf4.4_py3.9_env/bin/python
Checking if Python packages are up to date...
Python requirements from /tmp/esp-idf/requirements.txt are satisfied.
Added the following directories to PATH:
/tmp/esp-idf/components/esptool_py/esptool
/tmp/esp-idf/components/espcoredump
/tmp/esp-idf/components/partition_table
/tmp/esp-idf/components/app_update
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
Traceback (most recent call last):
File "/tmp/esp-idf/tools/idf.py", line 822, in
main()
File "/tmp/esp-idf/tools/idf.py", line 740, in main
cli(sys.argv[1:], prog_name=PROG, complete_var='_IDF.PY_COMPLETE')
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/core.py", line 1137, in call
return self.main(*args, **kwargs)
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/core.py", line 1057, in main
self._main_shell_completion(extra, prog_name, complete_var)
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/core.py", line 1132, in _main_shell_completion
rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction)
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/shell_completion.py", line 45, in shell_complete
echo(comp.source())
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/shell_completion.py", line 324, in source
self._check_version()
File "/home/cs/.espressif/python_env/idf4.4_py3.9_env/lib/python3.9/site-packages/click/shell_completion.py", line 319, in _check_version
raise RuntimeError(
RuntimeError: Couldn't detect Bash version, shell completion is not supported.
Expected Behavior
The script should work without above error, regardless the setting of $LANG, maybe it should store/restore the LANG setting while being executed.
Actual Behavior
See above traceback, there should be no error.
Steps to reproduce
Code to reproduce this issue
None needed.
Debug Logs
Other items if possible
build
folder (note this may contain all the code details and symbols of your project.)The text was updated successfully, but these errors were encountered: