start .pyo files with doubleclick on windows

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jan 25 14:44:14 EST 2010


En Sun, 24 Jan 2010 19:36:53 -0300, News123 <news123 at free.fr> escribió:

> Hi Alf,
>
>
>
>
>
> Alf P. Steinbach wrote:
>> * News123:
>>> Hi,
>>>
>>>
>>> I'd like to start .pyo files under windows with a double click.
>>
>> C:\> assoc .pyo
>> .pyo=Python.CompiledFile
>>
>> C:\> ftype python.compiledfile
>> python.compiledfile="C:\Program Files\cpython\python31\python.exe" "%1"  
>> %*
>>
>> C:\> _
>>
>>
>> Use ftype to change the association.
>
> Thanks a lot, I leared something new about Windows
>
>
> What I did now is this:
>
> assoc .pyo=Python.CompiledOptimizedFile
> ftype Python.CompiledOptimizedFile="C:\Python26\python.exe" -OO "%1" %*

This looks like a bug (or two)

- "python foo.pyo" should fail; a .pyo has a different magic number than a  
.pyc file. Importing a .pyo file fails in this case. A .pyo file should be  
run with "python -O foo.pyo" (or -OO)

- on Windows, .pyo files should be associated with python -O by default,  
you should not need to do that by yourself.

-- 
Gabriel Genellina




More information about the Python-list mailing list