[Tutor] How to use Python 2.6 with IDLE?
davea at ieee.org
Mon Jul 27 20:14:19 CEST 2009
Dick Moores wrote:
> On Mon, Jul 27, 2009 at 04:27, Gregor Lingl<gregor.lingl at aon.at> wrote:
>> Dick Moores schrieb:
>>> I've taken a long break from Python, and now I want to try scripting
>>> with 2.62. I downloaded and installed 2.62, changed Win XP
>>> environmental variables to use Python26. Entering python at the
>>> command line shows I'm using 2.62:
>>> C:\Documents and Settings\Riley>python
>>> Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
>>> (Intel)] on win32
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> So I'm able to try out the new features of 2.6 (I had been using
>>> 2.51), but I can't get IDLE to use 2.6. When I click on
>>> E:\Python26\Lib\idlelib\idle.pyw, I get an IDLE instance that says:
>>> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
>>> (Intel)] on win32
>>> Type "copyright", "credits" or "license()" for more information.
>>> And of course, the new 2.6 features don't work.
>>> Advice, please.
>> I suggest you have to change the association of *.pyw files to the
>> program, which is used to 'open' it.
>> In Windows explorer choose menu extras/directory options,
>> then choose tab file types and select PYW type
>> then press button 'advacned...' or somethng like this at the bottom
>> of the tab, chose 'open' and the button to change this.
>> If you see the entry
>> "C:\Python25\pythonw.exe" "%1" %*
>> change this to Python26
> Yes! After I did that, now when I call
> E:\Python26\Lib\idlelib\idle.pyw the IDLE that opens uses 2.62.
> But I also want to use Ulipad, actually my main Python editor. When I
> call E:\Programs\Ulipad3.7\UliPad.pyw (by clicking on it in Explorer),
> Ulipad no longer opens. Before I made the change you suggested, at
> least Ulipad would open using 2.51. What can I do to use both IDLE and
> Ulipad with 2.62?
I don't know IDLE, so I don't really know how it decides which Python to
use. In this thread Gregor suggested fixing the file association, which
is certainly reasonable. And I suggested what to me is an easier way to
fix associations. But there may be another way that I just don't know
about, such as some environment variable. You could send email to
idle-dev at python.org. One other thought: Idle.bat is located in the
install directory of python. So perhaps it locates the python that it's
running with. Could you try running it more explicitly? Make your own
bat file that instead of
start idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9
..\..\pythonw.exe idle.pyw %*
I do know that when you double-click on a xxx.pyw file in Explorer, it
will use the association to decide which program, and there's only one
program you can have there. My preference is to have it execute the
program, not start IDLE, a text editor, or any IDE. You may feel
differently, but if you agree with me, then you might want to add
UliPad.exe in the context menu of explorer. If you do that
successfully, then when you right-click on a .pyw file, one of your
choices will be "Run Ulipad."
The following is pretty-much pasted from some notes I took quite a while
ago, and may not be quite right. So if you're not pretty familiar with
the registry, you probably shouldn't experiment just based on this.
>>>In the Windows registry, add a new key under
>>>Make its default value the item text you want in the context menu.
>>>Add a new key under it, "command", and make its default value the
command line you want to execute. Will look like this:
>>>"complete path to ulipad.exe" %1 %*
>>>See http://msdn.microsoft.com/en-us/library/dd807139(VS.85).aspx for
In addition to adding it to right-click menu, you could also add it to
the "open-with" list, or to "Send-To" list. I don't have any cookbook
for any of these, but I've done each at one time or another.
More information about the Tutor