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

export would be failed in pwsh when getting IDF_PATH_OLD (IDFGH-14648) #15396

Open
3 tasks done
kaidegit opened this issue Feb 14, 2025 · 0 comments
Open
3 tasks done
Assignees
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@kaidegit
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.4-398-g473771bc14

Operating System used.

Windows

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

run export

What is the actual behavior?

failed

Steps to reproduce.

./export.ps1

Build or installation Logs.

Traceback (most recent call last):
  File "C:\Users\yekai\DevPkgs\esp\esp-idf\tools\export_utils\activate_venv.py", line 12, in <module>
    from console_output import CONSOLE_STDERR
  File "C:\Users\yekai\DevPkgs\esp\esp-idf\tools\export_utils\console_output.py", line 7, in <module>
    from utils import conf
  File "C:\Users\yekai\DevPkgs\esp\esp-idf\tools\export_utils\utils.py", line 28, in <module>
    conf = Config()
  File "C:\Users\yekai\DevPkgs\esp\esp-idf\tools\export_utils\utils.py", line 19, in __init__
    self.IDF_PATH_OLD = os.environ['IDF_PATH_OLD']
  File "C:\Softwares\Python39\lib\os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'IDF_PATH_OLD'

ERROR: Activation script failed
To view detailed debug information, set ESP_IDF_EXPORT_DEBUG=1 and run the export script again.

More Information.

I think it would gen a empty string to env, but it would be cleared after entry subprocess

os.environ['IDF_PATH_OLD'] = os.environ.get('IDF_PATH', '')

Some small test:

test1.py

import sys
from subprocess import run
import os
os.environ['IDF_PATH_OLD1'] = ""
os.environ['IDF_PATH1'] = "123"

print("test1")
try:
    print("IDF_PATH_OLD1: ", os.environ['IDF_PATH_OLD1'])
except KeyError:
    print("IDF_PATH_OLD1: KeyError")

try:
    print("IDF_PATH1: ", os.environ['IDF_PATH1'])
except KeyError:
    print("IDF_PATH1: KeyError")

cwd = os.getcwd()
run(["python", os.path.join(cwd, "test2.py")] + sys.argv[1:], check=True)

test2.py

import os

print("test2")
try:
    print("IDF_PATH_OLD1: ", os.environ['IDF_PATH_OLD1'])
except KeyError:
    print("IDF_PATH_OLD1: KeyError")

try:
    print("IDF_PATH1: ", os.environ['IDF_PATH1'])
except KeyError:
    print("IDF_PATH1: KeyError")

output

C:\Users\yekai\PycharmProjects\testenvempty\.venv\Scripts\python.exe C:\Users\yekai\PycharmProjects\testenvempty\test1.py 
test1
IDF_PATH_OLD1:  
IDF_PATH1:  123
test2
IDF_PATH_OLD1: KeyError
IDF_PATH1:  123
@kaidegit kaidegit added the Type: Bug bugs in IDF label Feb 14, 2025
@github-actions github-actions bot changed the title export would be failed in pwsh when getting IDF_PATH_OLD export would be failed in pwsh when getting IDF_PATH_OLD (IDFGH-14648) Feb 14, 2025
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants