microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.53k stars 677 forks source link

The active environment doesn't change with the Cookiecutter Explorer is open #7206

Open linette-zyy opened 1 year ago

linette-zyy commented 1 year ago

Environment image

Steps to Reproduce 1.Launch VS and open a local folder image 2.Select View > Cookiecutter Explorer 3.Add a python file 4.Add a virtual environment 'env' in toolbar combo box, check the 'Set current environment' image 5.Check if a tip pops up and select 'Always trust' image 6.Make sure the active environment is changed as 'env'

Expected behavior A tip pops up and the active environment changes as 'env' after selecting 'Always trust' image Cookiecutter Explorer_sucessful

Actual behavior No tip pops up and the active environment doesn't change as 'env' Cookiecutter Explorer_fail

Note The active environment doesn't change with the Cookiecutter Explorer is open, the active environment changes with the Cookiecutter Explorer is closed

linette-zyy commented 1 year ago

image I can repro this in other steps: 1.Launch VS and 'Continue without code' 2.Select View > Cookiecutter Explorer 3.Load a template from the "Recommended" section 4.Add a virtual environment 'env' in toolbar combo box, check the 'Set current environment' cookiecutter_withoutcode

linette-zyy commented 1 year ago

On the latest build 17.6.0 Preview 1.0 [33319.311.main], Python Package: 17.0.23005.2, this issue still occurred. image No tip pops up and the active environment doesn't change as 'env'

StellaHuang95 commented 1 year ago

@linette-zyy Does this still repro? I can't repro it and I don't see the "Python was found" error either.

linette-zyy commented 1 year ago

@StellaHuang95 In today's latest build:17.6.0 Preview 2.0 [33423.321.main],Python package:17.0.23047.1, I can repro in two scenarios, the active environment doesn't change as 'env'

Scenarios 1 1.Launch VS and open a local folder 2.Select View > Cookiecutter Explorer 3.Add a python file 4.Add a virtual environment 'env' in toolbar combo box, check the 'Set current environment' 5.Check the active environment if is 'env' active_env_03

Scenarios 2 1.Launch VS and open cookiecutter explorer 2.Load the following template: https://github.com/brettcannon/python-azure-web-app-cookiecutter 3.Keep default values and click Create and Open Folder 4.Open webapp.py and add a virtual environment 'env' in toolbar combo box, check the 'Set current environment' 5.Check the active environment if is 'env' active_env_02

Note: Only when this tip pops up and select ''Always trust'' or 'Trust this time', the active environment will changes as 'env' image