pythonipythonvista64

How to configure ipy_user_conf.py to get IPython to to start with the right IDLE set as editor?


64-bit Vista Python 2.6 IPython 0.10 Also have Python 2.7 and 3.1

My ipy_user_conf.py has example lines showing how to set an editor. I've tried

ipy_editors.idle()

but

[C:Python26/Scripts] |4>ed xxx.py Editing... > C:\Python26\lib\idlelib/idle.py "xxx.py"

opens the IDLE for Python 3.1, and doesn't open xxx.py.

I next imitated a sample line in ipy_user_conf.py,

ipy_editors.scite('c:/opt/scite/scite.exe')

as

ipy_editors.idle("c:/Python26/Lib/idlelib/idle.pyw")

but

[C:Python26/Scripts] |4>ed xxx.py Editing... > c:/Python26/Lib/idlelib/idle.pyw "xxx.py"

opens the FILE c:/Python26/Lib/idlelib/idle.pyw in the IDLE for Python 3.1

I've run out of ideas. Advice, please.

BTW run xxx.py works fine.


Solution

  • The most likely cause is Windows' file name extension associations. I'm guessing Python 3.1 was the last version of python that you installed, so by default, .py and .pyw are now associated with the 3.1 executable. (One way you can verify which python version is associated with the .py/.pyw extensions is to run assoc .py. There are other ways also.)

    To get around this, explicitly say which python version you want to run:

    ipy_editors.idle('c:/Python26/pythonw.exe c:/Python26/Lib/idlelib/idle.pyw')
    

    Edit:
    A pythonic way to test the association would be to create a test.py file such as:

    import sys
    print sys.version
    

    Then at a command prompt, just run it as test.py.