- Notifications
You must be signed in to change notification settings - Fork18
Closed
Description
tox doesn't passLOCALAPPDATA to subcommands by default, so when callingpy.exe from a tox command, it can't find any runtimes, even when they are installed.
I'm planning to raise in issue on the tox project to pass that env var on windows. Is there is anything else that is needed to ensure tox and py.exe work correctly together?
Background
Installed using version 20.1b1 as documented herehttps://www.python.org/downloads/release/pymanager-251b1/
Details
I have a python script that is called by tox. This script callspy.exe with a specific python version set. Running this script directly withpy.exe works fine as expected. Something like:
importsubprocesssubprocess.run(["py.exe","-V:3.12","-c","pass"],check=True)
And a tox file
[testenv]commands = python call_py.py
When running tox, the subprocess call topy.exe fails with following error.
❯ uvx toxpy: commands[0]> python call_py.py[ERROR] No runtime installed that matches 3.12. Try running "py install 3.12".Traceback (most recent call last): File "C:\Users\clawrence\dev\pymanager\call_py.py", line 3, in <module> subprocess.run(["py.exe", "-V:3.12", "-c", "pass"], check=True) File "C:\Users\clawrence\AppData\Roaming\uv\python\cpython-3.10.18-windows-x86_64-none\lib\subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args,subprocess.CalledProcessError: Command '['py.exe', '-V:3.12', '-c', 'pass']' returned non-zero exit status 2684354566.py: exit 1 (0.80 seconds) C:\Users\clawrence\dev\pymanager> python call_py.py pid=19416 py: FAIL code 1 (1.08=setup[0.28]+cmd[0.80] seconds) evaluation failed :( (1.16 seconds)~\dev\pymanager via 🐍 v3.14.0 (installer) took 3s❯ py -V:3.12 -c "pass"~\dev\pymanager via 🐍 v3.14.0 (installer)❯ py call_py.py~\dev\pymanager via 🐍 v3.14.0 (installer)❯