Mark Mikofski <bwana.ma...@yahoo.com> added the comment:
Would you consider just handling activate for windows directly in the lib/venv/__init__.py method "install_scripts(self, context, path)" https://github.com/python/cpython/blob/4f98f465f14e7258c5b18a62c5aa114dbe1174d8/Lib/venv/__init__.py#L382 if not srcfile.endswith(('.exe', '.pdb')): # handle activate for Windows (ignore WSL) if srcfile == "activate": # from docs: on unix drive is always empty d, p = os.path.splitdrive(context.env_dir) d = d.replace(':', '') p = p.replace('\\', '/') if d: p = '/' + d + p data = data.decode('utf-8') data = data.replace('__VENV_DIR__', p) data = data.encode('utf-8') try: data = data.decode('utf-8') data = self.replace_variables(data, context) data = data.encode('utf-8') except UnicodeError as e: IMHO I don't think the use of windows python in WSL is a realistic use-case, my preference would be to just make this fail. In fact I tried to use it, and I could not make it work. 1. /mnt/c/path/to/python -m venv venv Error: [WinError 5] Access is denied: 'C:\\WINDOWS\\system32\\venv' 2. /mnt/c/path/to/python -m venv -m venv /mnt/c/some/path/to/venv fails silently, appears to do nothing, venv is not created 3. /mnt/c/path/to/python -m venv -m venv 'C:/some/path/to/venv' makes directories at C:\some\path\to\venv, but can't be activated in WSL, that I can figure out source /mnt/c/some/path/to/venv/Scripts/activate : command not found -bash: /mnt/c/some/path/to/venv/Scripts/activate: line 4: syntax error near unexpected token `$'{\r'' 'bash: /mnt/c/some/path/to/venv/Scripts/activate: line 4: `deactivate () { I guess I don't really understand why it would be useful to use the windows python in WSL, and if that's the only thing holding a quick fix for this, I guess, I would prefer to just handle windows python in windows in git-bash, and ignore WSL. Would you be open to that? If so, I'm happy to submit a PR thanks! ---------- nosy: +bwanamarko _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38583> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com