I want to use Python's subprocess.check_output to check if the command python is in PATH and its version. The funny thing is that check_output is able to run the command python even if it's not in PATH:
C:\Users\Aivar\Desktop>set PATH=blahblah
C:\Users\Aivar\Desktop>python --version
'python' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Aivar\Desktop>c:\python35\python -c ^
More? "import subprocess; ^
More? print(subprocess.check_output(['python', '--version']))"
b'Python 3.5.1\r\n'
C:\Users\Aivar\Desktop>c:\python35\python -c ^
More? "import os; print(os.environ['PATH'])"
blahblah
Can someone explain what's going on?