ESP-IDF vscode extension defaults to Python 2.7 venv

UsernameYouEntered
Posts: 1
Joined: Sun May 23, 2021 12:09 pm

ESP-IDF vscode extension defaults to Python 2.7 venv

Postby UsernameYouEntered » Sun May 23, 2021 12:40 pm

Hello folks, I am testing the ESP-IDF environment (1.0.3) within vscode under Ubuntu 18.04LTS.
When running the debug (ESP-prog, ESP32 DOIT target), the ESP-IDF interface throws a syntax error,

Code: Select all

  File "/home/foobert/.vscode/extensions/espressif.esp-idf-extension-1.0.3/esp_debug_adapter/debug_adapter/debug_backend/debug_backend/gdb.py", line 471
    nonlocal target_output
                         ^
SyntaxError: invalid syntax
[Stopped] : ESP-IDF Debug Adapter
This looks like a Python 3 keyword used in a Python 2 environment, and sure enough running a 'ESP-IDF terminal'

Code: Select all

python --version
shows 2.7, while the bash terminal in vscode is 3.6

Code: Select all

.espressif/python_env/idf4.2_py3.6_env/bin/python --version
also gives Python 2.7.17, this is the Python venv location specified in "idf.pythonBinPath", in my installation settings.json

Ubuntu uses Python 2 as default, but I had changed this to Python 3.6, verified in a bash terminal.

My question is whether ESP-IDF vscode extension requires Python 2 (which would require a debug rewrite), or how it is possible to force use of Python to 3 for the ESP-IDF vscode environment.
Are there further steps required to force use of Python 3 using the 'ESP-IDF: Configure ESP-IDF extension' script?
I note that pip fails when 'python3' option is selected for this script install.

ESP_bignacio
Posts: 229
Joined: Wed May 02, 2018 12:12 pm

Re: ESP-IDF vscode extension defaults to Python 2.7 venv

Postby ESP_bignacio » Tue May 25, 2021 3:32 am

It seems that your system environment is using python2 over python3 being added from the extension in idf.customExtraPaths.

What is the content of your environment PATH ? Do you have any reference to python2 before the path of python3 virtual env

You can use the `ESP-IDF: Doctor command` also to check your extension configuration to check if settings are correct.

On the `ESP-IDF: Configure ESP-IDF extension` you can choose which python executable to use as shown in https://github.com/espressif/vscode-esp ... install.md

Who is online

Users browsing this forum: No registered users and 49 guests