"py.ini" question

Gisle Vanem gisle.vanem at gmail.com
Sat Apr 24 15:56:15 EDT 2021


Barry Scott wrote:

>> 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?

> On windows 10 your personal py.ini is in %localappdata%\py.ini
> do you have one?

Yes, that's my 'c:\Users\Gisle\AppData\Local\py.ini'
in my case.

> C:\Users\barry>py -0
> Installed Pythons found by py Launcher for Windows
>   -3.10-64
>   -3.10-32
>   -3.9-64 *
>   -3.9-32
>   -3.8-64
>   -3.8-32
>   -3.7-64
>   -3.7-32
>   -3.6-64
>   -3.6-32
>   -3.5-64
>   -3.5-32
>   -3.4-64
>   -3.4-32
>   -2.7-64
>   -2.7-32

On that, I'm getting:
   Requested Python version (0) not installed

Is that '-0' some 3.9+ feature?

> C:\Users\barry>py
> Python 3.9.4 (tags/v3.9.4:1f2e308, Apr  6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
With a 'py', I get:
   Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32

With 'py -3.6' or 'py 3.8' I get the expected.
But with 'py -3':
   Python 3.8.9 (default, Apr 13 2021, 15:54:59)  [GCC 10.2.0 64 bit (AMD64)] on win32

Since I'm on a 64-bit Python, a 'py -3' totally seems to ignore
'py.ini', unless it says:
   [defaults]
   python3=3.6
   python3=3.6-32

Strange as always.

And yes, Mats Wichmann, I've tried a 'set PYLAUNCH_DEBUG=1'.
No help.

-- 
--gv


More information about the Python-list mailing list