Proper set-up for a co-existant python 2.6 & 3.1 installation

Mark Tolonen metolone+gmane at gmail.com
Wed Aug 25 03:57:44 EDT 2010


> "vsoler" <vicente.soler at gmail.com> wrote in message 
> news:3d85d8f5-8ce0-470f-b6ec-c86c452a335b at a36g2000yqc.googlegroups.com...
> On Aug 24, 1:33 am, "Martin v. Loewis" <mar... at v.loewis.de> wrote:
> > > When I am logged-in in a session as an administrator, the BAT file on
> > > the Desktop, and I double-click on it, it does not work.
> >
> > This is not what I meant. Instead, right-click on the BAT file,
> > and select "run as administrator".
> >
> > > When you say to double-escape the percent signs, do you mean that in
> > > my BAT file I should write...
> >
> > > FTYPE python.file="C:\Python26\python.exe" "%%1" %%*
> >
> > > and the inverted commas around %%*, are they not necessary?
> >
> > No, I don't think so.
> >
> > Regards,
> > Martin
>
> Martin (or anybody else),
>
> The problem with FTYPE is solved.
>
> However, after having switched to py 3.1 with the help of the BAT
> script (which only changes FTYPE) I have another problem.
>
> (Just for reference, here is my batch file)
>
> @ECHO OFF
> ECHO ************************************************
> ECHO Cambia a Python 3.1
> ECHO ************************************************
> ECHO *
> ECHO FTYPES:
> ECHO *
> ECHO .py=Python.File
> ECHO .pyc=Python.CompiledFile
> ECHO .pyo=Python.CompiledFile
> ECHO .pys=pysFile
> ECHO .pyw=Python.NoConFile
> ECHO *
> ECHO ************************************************
> ECHO *
> FTYPE python.file="C:\Python31\python.exe" "%%1" %%*
> FTYPE python.compiledfile="C:\Python31\python.exe" "%%1" %%*
> FTYPE python.NoConFile="C:\Python31\pythonw.exe" "%%1" %%*
> ECHO *
> Pause
> @ECHO ON
>
> The problem is that, if I am on top of a .py file, and, with the
> mouse, I click on the right button, then I click on "Edit with IDLE",
> I get the 2.6 system, not the 3.1 one (which was supposed to be the
> correct one after the change).
>
> My question is: are there any other changes that I should do in order
> to fully switch from one version to another?

Yes, and they are relatively easy to edit with a .reg file instead of a 
batch file.  Below is just an example for type "Python.File" that adds "Open 
with Python3", "Edit with IDLE3", and "Open with Pythonwin3" commands to the 
right-click context menu of a .py file.  The first 3 entries are the 
original Python26 entries.  The last three were copied from them and 
modified to create the alternative context menus.  You could also create two 
.reg files that toggle the original three entries between Python 2.6 and 
Python 3.1 if you want.

-----------------------START------------------------

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command]
@="\"C:\\Python26\\pythonw.exe\" 
\"C:\\Python26\\Lib\\idlelib\\idle.pyw\" -n -e \"%1\""

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with Pythonwin\command]
@="C:\\Python26\\Lib\\site-packages\\Pythonwin\\Pythonwin.exe /edit \"%1\""

[HKEY_CLASSES_ROOT\Python.File\shell\open\command]
@="\"C:\\Python26\\python.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE3\command]
@="\"C:\\Python31\\pythonw.exe\" 
\"C:\\Python31\\Lib\\idlelib\\idle.pyw\" -n -e \"%1\""

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with Pythonwin3\command]
@="C:\\Python31\\Lib\\site-packages\\Pythonwin\\Pythonwin.exe /edit \"%1\""

[HKEY_CLASSES_ROOT\Python.File\shell\Open with Python3\command]
@="\"C:\\Python31\\python.exe\" \"%1\" %*"

-------------------END---------------------------

-Mark 





More information about the Python-list mailing list