[Python-ideas] Windows temporary file association for Python files

Mark Lawrence breamoreboy at yahoo.co.uk
Mon Oct 22 15:16:49 CEST 2012


On 22/10/2012 13:42, anatoly techtonik wrote:
> On Mon, Oct 22, 2012 at 2:44 PM, Paul Moore <p.f.moore at gmail.com> wrote:
>> On 22 October 2012 11:51, anatoly techtonik <techtonik at gmail.com> wrote:
>>> I wonder if it will make the life easier if Python was installed with
>>> .py association to "%PYTHON_HOME%\python.exe" "%1" %*
>>> It will remove the need to run .py scripts in virtualenv with explicit
>>> 'python' prefix.
>>
>> In Python 3.3 and later, the "py.exe" launcher is installed, and this
>> is the association for ".py" files by default. It looks at the #! line
>> of .py files, so you can run a specific Python interpreter by giving
>> its full path. You can also specify (for example) "python3" or
>> "python3.2" to run a specific Python version.
>
> Yes, I've noticed that this nasty launcher gets in the way. So, do you
> propose to edit source files every time I need to test them with a new
> version of Python? My original user story:

I see nothing nasty in the launcher, rather it's extremely useful.  You 
don't have to edit your scripts.  Just use py -3.2, py -2 or whatever to 
run the script, the launcher will work out which version to run for you 
if you're not specific.

>
>      I want to execute scripts in virtual environment (i.e. with Python
> installed for this virtual environment) without 'python' prefix.
>
> Here is another one. Currently Sphinx doesn't install with Python 3.2
> and with Python 3.3 [1]. Normally I'd create 3 environments to
> troubleshoot it and I can not modify all Sphinx files to point to the
> correct interpreter to just execute 'setup.py install'.

Please try running your scripts with the mechanism I've given above and 
report back what happens, hopefully success :)

>
> A solution would be to teach launcher to honor PYTHON_PATH variable if
> it is set (please don't confuse it with PYTHONPATH which purpose is
> still unclear on Windows).

What is PYTHON_PATH?  IIRC I was told years ago *NOT* to use PYTHONPATH 
on Windows so its purpose to me isn't unclear, it's completely baffling.

>
> 1. https://bitbucket.org/birkenfeld/sphinx/issue/1022/doesnt-install-with-python-32-and-33-on
>


-- 
Cheers.

Mark Lawrence.




More information about the Python-ideas mailing list