This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: venv activate script would be good to show failure.
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: idle947, vinay.sajip
Priority: normal Keywords:

Created on 2021-06-02 14:03 by idle947, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg394909 - (view) Author: john kim (idle947) Date: 2021-06-02 14:03
I changed the path of the project using venv, so it didn't work properly.

I thought it worked successfully because there was a (venv) on the terminal line.

However, the __VENV_DIR__ in the 

set "VIRTUAL_ENV=__VENV_DIR__" 

in the activate script did not work properly because it was the PATH before the replacement.

How about adding a procedure to verify the __VENV_DIR__ is a valid PATH to the Activate Script?
msg394997 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-06-03 13:03
venvs aren't meant to be portable (i.e. renaming the directory or moving to a new location). Scripts installed into a venv have absolute paths pointing to the location when the venv was created.

venvs should be treated as throwaway resources that can be readily recreated - so if you need a venv in a new location, just create it there and install the desired packages again.
msg395002 - (view) Author: john kim (idle947) Date: 2021-06-03 14:26
Thank you for your explanation of venv.

I understand that venv is not portable. 

But I was confused because the venv was written on the left side of the terminal line and it looked like it was working.

Therefore, if venv does not work, such as if __venv_dir__ is invalid path, i thought any warning message or exception handling was necessary. Or (venv) doesn't show up.
msg395074 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-06-04 11:18
> i thought any warning message or exception handling was necessary. Or (venv) doesn't show up.

No, because these are just scripts created by venv and placed in the venv's directory tree. If you then move the files to a different location, they aren't engineered to notice, and so will not behave as you expect.

As venv's aren't meant to be moved, there's no particular reason to engineer for that possibility.

OK to close this issue as "not a bug"?
msg395083 - (view) Author: john kim (idle947) Date: 2021-06-04 13:43
Okay. Thank you for the detailed explanation.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88452
2021-06-04 13:43:29idle947setstatus: open -> closed
resolution: not a bug
messages: + msg395083

stage: resolved
2021-06-04 11:18:33vinay.sajipsetmessages: + msg395074
2021-06-03 14:26:20idle947setmessages: + msg395002
2021-06-03 13:03:10vinay.sajipsetmessages: + msg394997
2021-06-02 18:15:50ned.deilysetnosy: + vinay.sajip
2021-06-02 14:03:06idle947create