"py.ini" question

Mats Wichmann mats at wichmann.us
Sat Apr 24 11:34:30 EDT 2021


On 4/24/21 8:23 AM, Gisle Vanem wrote:
> I have a question about the Python launcher;
>    c:\Windows\py.exe and the py.ini file.
> 
> I have both Python 3.6 (32-bit) and Python 3.8 (64-bit)
> installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini'
> with this only:
>    [defaults]
>    python=3.6
> 
> A copy of this is also in 'c:\Windows\py.ini'.
> So when I do a:
>    py -3 -c "import sys; print(sys.version)"
> 
> I would assume a "3.6..." would be printed.
> But no, py.exe chooses to run my newest Python 3.8:
>    3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)]
> 
> Only when I do 'py -3.6 -c ...', I get what I'd expect.
> 
> So is a 'py.ini' and the '[defaults]' simply ignored
> or is my syntax wrong?
> 

You could try this:

"If an environment variable PYLAUNCH_DEBUG is set (to any value), the 
launcher will print diagnostic information to stderr (i.e. to the 
console). While this information manages to be simultaneously verbose 
and terse, it should allow you to see what versions of Python were 
located, why a particular version was chosen and the exact command-line 
used to execute the target Python."

and see what it teaches you...



More information about the Python-list mailing list