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

Windows - The script files in path C:\Users\{user}\.espressif\python_env\idf5.3_py3.11_env\Scripts will report an error when executed in ESP-IDF Terminal (VSC-1489) #1310

Open
xinkunlong opened this issue Sep 13, 2024 · 2 comments
Assignees
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) ongoing Ongoing Issue or PR, this label will be used for issue or PR which is to be excluded by stale bot

Comments

@xinkunlong
Copy link

OS

Windows

Operating System version

Windows 11

Visual Studio Code version

Version: 1.93.0 (user setup) Commit: 4849ca9bdf9666755eb463db297b69e5385090e3 Date: 2024-09-04T13:02:38.431Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631

ESP-IDF version

5.3.1

Python version

3.11.2

Doctor command output

  • open ESP-IDF Terminal by Espressif IDF extension
  • Execute any script in C:\Users\{user}\.espressif\python_env\idf5.3_py3.11_env\Scripts
    • examples
    • esptool.py help or hex2bin.py help
esptool.py help
PS C:\Users\kunlo\Downloads> ^C\Users\kunlo\.espressif\python_env\idf5.3_py3.11_env\Scripts\esptool.py:2
PS C:\Users\kunlo\Downloads> 
^

SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:13801)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:189:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.15.1
hex2bin.py help
PS C:\Users\kunlo\Downloads> C:\Users\kunlo\.espressif\python_env\idf5.3_py3.11_env\Scripts\hex2bin.py:3
# Copyright (c) 2005-2018 Alexander Belchenko
^

SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:13801)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:189:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.15.1

Extension

esp_idf_vsc_ext.log

Description

The script files in path C:\Users\{user}\.espressif\python_env\idf5.3_py3.11_env\Scripts will report an error when executed in ESP-IDF Terminal

Debug Message

esptool.py help
PS C:\Users\kunlo\Downloads> C:\Users\kunlo\.espressif\python_env\idf5.3_py3.11_env\Scripts\esptool.py:2
#
^

SyntaxError: Invalid or unexpected token
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1328:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1432:10)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:13801)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:189:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.15.1


### Other Steps to Reproduce

_No response_

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@xinkunlong xinkunlong added the bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) label Sep 13, 2024
@github-actions github-actions bot changed the title Windows - The script files in path C:\Users\{user}\.espressif\python_env\idf5.3_py3.11_env\Scripts will report an error when executed in ESP-IDF Terminal Windows - The script files in path C:\Users\{user}\.espressif\python_env\idf5.3_py3.11_env\Scripts will report an error when executed in ESP-IDF Terminal (VSC-1489) Sep 13, 2024
Copy link

This issue has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities

@github-actions github-actions bot added the stale Stale PR or Issue label Sep 29, 2024
@radurentea radurentea self-assigned this Sep 30, 2024
@radurentea radurentea added ongoing Ongoing Issue or PR, this label will be used for issue or PR which is to be excluded by stale bot and removed stale Stale PR or Issue labels Sep 30, 2024
@radurentea
Copy link
Collaborator

radurentea commented Oct 1, 2024

Hi @xinkunlong,

Thank you for reporting this bug. After investigating, I've identified the root cause:

The issue stems from the default program setting for .py files on your Windows machine. It appears you've set .py files to open with "VS Code" by default.

Workaround:
Change the default program for .py files to the Python executable in your PATH:
"C:\Users\kunlo.espressif\python_env\idf5.3_py3.11_env\Scripts\python.exe"

This should resolve the immediate issue. I'm still investigating a permanent solution to prevent this behavior. I'll update you once I have more information.

Let me know if you need any clarification or assistance implementing the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) ongoing Ongoing Issue or PR, this label will be used for issue or PR which is to be excluded by stale bot
Projects
None yet
Development

No branches or pull requests

2 participants