On approximately 12/4/2008 5:29 AM, came the following characters from
the keyboard of Colin J. Williams:
Glenn Linderman wrote:
The equivalent of those commands is available via Windows Explorer,
Tools / Folder Options, File Types, scroll-scroll-scroll your way to
.py, Click Advanced, fiddle, copy paste apply, and other twaddle.
Yes, but what's needed is a further level of indirection. Currently,
this allows .py to be associated with a particular editor. It would
be great if there were some way of associating "Python.File", which is
created in the install process, with a particular editor. Then, one
is left with associating "Python.File" with a given version of
Python. Meanwhile, your suggestion provides a workaround.
Sure, it is possible to simply change the Python.File ftype -- just
issue the command
ftype Python.File="C:\PythonNN\python.exe" "%1" %*
for NN = 25, 26 or 30 or whatever. But that is longer and harder to
remember and type than the assoc which is why chose to keep three ftypes
around and switch between them with the assoc command. But if you put
them in a batch file, or shortcut, the length and complexity wouldn't be
as much of an issue. But changing one or changing the other is roughly
equivalent... ftype is an extra level of indirection over assoc... and
it is designed to allow programs that handle multiple extensions to not
proliferate the full command for each extensions. For example, a
multi-image-format image program, could use something like:
assoc .jpg=ImageProg.File
assoc .gif=ImageProg.File
assoc .tif=ImageProg.File
ftype ImageProg.file="C:\Program Files\ImageProg\ImageProg.exe" "%1" %*
In that situation, because of the potentially large number of
extensions, changing the assoc isn't equivalent to changing the ftype,
but for Python, I'm unaware of it needing to handle multiple extensions
from the command line or via double clicking in Explorer, so was
exploiting the extra level of indirection to save typing, and make the
command simpler to remember.
Not sure what your reference to an editor is about. ftype only fiddles
with the Shell Open command; if you want to do tricks with different
editors for different versions of Python, then you have to fiddle the
Shell Edit command; this can be done with clever manipulation of the
registry... it would be straightforward to create a .reg file that swaps
both the Shell Open and Shell Edit commands for different versions of
Python, if that is useful... and maybe it is if you use an IDE of some
sort. Since I just use emacs to edit .py files, I ignored the Shell
Edit command. Instead I have a Shell Emacs command that is set up to
apply to all file types, and is available via the context menu from
Windows Explorer... but I use that not only for different versions of
Python, but source code in other languages, and text files of all types.
--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking
--
http://mail.python.org/mailman/listinfo/python-list