[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings
wolfgang kuehn added the comment: I can confirm that setting __PYVENV_LAUNCHER__ to ANY path with prefix ./venv/Scripts/ does indeed mark the python session as being a virtual environment, no special permissions needed. However, you will have no tooling support whatsoever (e.g. PyCharms Package Mngt) because __PYVENV_LAUNCHER__ is, after all, non-standard. -- ___ Python tracker <https://bugs.python.org/issue46056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings
wolfgang kuehn added the comment: Currently we have a glitch in our internal access rights system. This resulted in me loosing my Admin-privileges. I can only install python from the app-store, which is ok. But without venv support I am stuck for the time being. -- ___ Python tracker <https://bugs.python.org/issue46056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46056] Cannot use virtual environment on Windows 10 in corporate security settings
wolfgang kuehn added the comment: symlinks do not work for me, this may be another bug (should I create a new issue?): python -m venv --without-pip --symlinks venv Unable to symlink 'C:\\Users\\\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\idle.exe' to 'C:\\\venv\\Scripts\\idle.exe' Error: [Errno 22] Invalid argument: 'C:\\Users\\\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\idle.exe' -- ___ Python tracker <https://bugs.python.org/issue46056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46056] Cannot use virtual environment on Windows 10 in cooperate security settings
Change by wolfgang kuehn : -- title: Cannot use virtual environment on Windows 10 in cooperate security settingss -> Cannot use virtual environment on Windows 10 in cooperate security settings type: -> behavior ___ Python tracker <https://bugs.python.org/issue46056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue46056] Cannot use virtual environment on Windows 10 in cooperate security settingss
New submission from wolfgang kuehn : I just installed Python3.10.1 from the Windows 10 App Store. Most workflows depend on creating virtual environments, but (1) python -m venv venv # -> Error 1260: Windows cannot open this program because it has been prevented by a software restriction policy However, a (2) python -m venv --without-pip venv completes, only to not allow execution of (3) .\venv\Scripts\python.exe # -> Error 1260: Windows cannot open this program because it has been prevented by a software restriction policy Reason for this probably are the (not so unreasonable) cooperate Software Restriction Policy (in our case enforced by Applocker): You are not allowed to execute from where you are allowed to write. So basically Python is broken in many MS Windows cooperate settings. Cooperate meaning (Software Restriction Policies) + (Usage of Virtual Environments). And my feeling is that it does not need to be, the virtual environment implementation with those *.exe copies being a kludge, IMHO. Note: (2) is reminiscent of bpo-45337, which was fixed with 3.9. -- components: Installation messages: 408380 nosy: wolfgang-kuehn priority: normal severity: normal status: open title: Cannot use virtual environment on Windows 10 in cooperate security settingss versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46056> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45237] Python subprocess not honoring append mode for stdout on Windows
wolfgang kuehn added the comment: The second alternative (wrapping the OS handle in a file descriptor) works like a charm, and is the less invasive workaround code-wise. Thanks for the magic, which I must respect as such :-) Still I feel that this is a bug since (a) it shows an unexpected behaviour, and (b) it fails to abstract away the operating system. -- ___ Python tracker <https://bugs.python.org/issue45237> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45237] Python subprocess not honoring append mode for stdout on Windows
New submission from wolfgang kuehn : On Windows, if you pass an existing file object in append mode to a subprocess, the subprocess does **not** really append to the file: 1. A file object with `Hello World` content is passed to the subprocess 2. The content is erased 3. The subprocess writes to the file 4. The expected output does not contain `Hello World` Demo: import subprocess, time, pathlib, sys print(f'Caller {sys.platform=} {sys.version=}') pathlib.Path('sub.py').write_text("""import sys, time time.sleep(1) print(f'Callee {sys.stdout.buffer.mode=}')""") file = pathlib.Path('dummy.txt') file.write_text('Hello World') popen = subprocess.Popen([sys.executable, 'sub.py'], stdout=file.open(mode='a')) file.write_text('') time.sleep(2) print(file.read_text()) Expected output on Linux Caller sys.platform='linux' sys.version='3.8.6' Callee sys.stdout.buffer.mode='wb' Unexpected bad output on Windows Caller sys.platform='win32' sys.version='3.8.6' NULNULNULNULNULNULNULNULNULNULNULCallee sys.stdout.buffer.mode='wb' Note that the expected output is given on Windows if the file is opened in the subprocess via `sys.stdout = open('dummy.txt', 'a')`. So it is definitely a subprocess thing. -- components: IO messages: 402096 nosy: wolfgang-kuehn priority: normal severity: normal status: open title: Python subprocess not honoring append mode for stdout on Windows type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue45237> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com