Page 1 of 1

esp32 idf in vsc, build flash working, can't monitor

Posted: Wed Apr 29, 2020 5:15 am
by trustmiao
I installed idf3.3 with python 3.8. in windows CMD tested ok. and then installed "espressif idf 0.2.1" in vsc, after a successful installation. In f1 menu, "esp-idf build", "esp-idf flash" all work perfectly. However, when I try to use "esp-idf monitor", it is error :

Code: Select all

G:\esp32_apps\blink>set IDF_PATH=G:\esp_vsc\esp-idf

G:\esp32_apps\blink>G:\esp_vsc\.espressif\python_env\idf3.3_py3.8_env\Scripts\python.exe G:\esp_vsc\esp-idf\tools\idf.py -p COM7 monitor
Traceback (most recent call last):
  File "G:\esp_vsc\esp-idf\tools\idf.py", line 635, in <module>
    if ('MSYSTEM' in os.environ) and (not os.environ['_'].endswith(WINPTY_EXE) and WINPTY_VAR not in os.environ):
  File "G:\python38\lib\os.py", line 673, in __getitem__
    raise KeyError(key) from None
KeyError: '_'
if I open CMD and execute idf.py monitor in thr project folder, it works. I've reinstalled idf, vsc, and vsc espressif plugin, doesn't help. all help will be welcome

Re: esp32 idf in vsc, build flash working, can't monitor

Posted: Wed Apr 29, 2020 6:28 am
by ESP_Roland
Hi trustmiao,

please check the content of your PATH environment variable. It seems that it invokes the MSYS python. The path to Python which you installed for Windows CMD must be earlier in PATH then the path pointing to the MSYS binary directory.

Re: esp32 idf in vsc, build flash working, can't monitor

Posted: Wed Apr 29, 2020 7:42 am
by trustmiao
ESP_Roland wrote:
Wed Apr 29, 2020 6:28 am
Hi trustmiao,

please check the content of your PATH environment variable. It seems that it invokes the MSYS python. The path to Python which you installed for Windows CMD must be earlier in PATH then the path pointing to the MSYS binary directory.
G:\esp_vsc\.espressif\python_env\idf3.3_py3.8_env\Scripts
i guessed that too. however, it is on thop of my PATH, and under windows it works alright. if it's the link to python not corrent, why build and flash will work. i could not figure out. However, when vsc open terminal for espidf-monitor(cmd), idf.py build doesn't work under this termial as well. how can I set up this terminal, while the cmd from windows prompt or explorer works alright.

Re: esp32 idf in vsc, build flash working, can't monitor

Posted: Wed Apr 29, 2020 9:24 am
by ESP_Roland
Are you checking the value of PATH from inside VSCode terminal? Because I think there it is incorrect.

Re: esp32 idf in vsc, build flash working, can't monitor

Posted: Thu Apr 30, 2020 8:42 am
by trustmiao
ESP_Roland wrote:
Wed Apr 29, 2020 9:24 am
Are you checking the value of PATH from inside VSCode terminal? Because I think there it is incorrect.
I totally agree, i will try to reset the path in terminal , will see can i get it solved

Re: esp32 idf in vsc, build flash working, can't monitor

Posted: Thu Apr 30, 2020 9:04 am
by trustmiao
it's solved, for record. this computer used to be set up in esp idf in msys environment , there are settings in
"preferences: open settings(json)"
still pointed top msys mingw32, which cause the problem. deleted these , and it is working now. thanks for help