start .pyo files with doubleclick on windows

Alf P. Steinbach alfps at start.no
Sun Jan 24 22:25:53 CET 2010


* News123:
> Hi,
> 
> 
> I'd like to start .pyo files under windows with a double click.
> (I know I can just write a .bat wrapper, but somehow it would be more
> fun to start with a direct double click)
> 
> 
> Currently this works if the file does not import any  other .pyo file.
> 
> 
> The problem is, that a dobleclick performs a
> "python.exe  myfile.pyo"
> 
> In order to import precompiled .pyo files however it seems, that
> "python.exe  -OO myfile.pyo"
> 
> would be required.
> 
> 
> Is there any trick to do this under windows?
> The only trick, that I can think of is to write a small wrapper
> executable, that would then call python -OO.
> 
> 
> Wouldn't it be useful if python searched also for .pyo files when trying
> to import and being invoked with
> 
> "python.exe mycode.pyo"
> 
> 
> thanks in advance for any ideas suggestion


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.


Cheers & hth.,

- Alf



More information about the Python-list mailing list