Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

D

Dennis Lee Bieber

Months ago 2.5.2 stopped functioning on my Win7 PC, so a few days ago I
uninstalled and installed. Same problem. If one right-clicks on a py
file, IDLE is not shown in the menu as Edit with IDLE. After playing
with matters I gave up, and uninstalled 2.5.2 and turned to 2.7.2. Same
results.

If I look at a 2.4 install on my laptop, I get the desired reference to
Edit with IDLE.
Fine... so open a directory window, follow

Tools/Folder Options/File Types

Scroll down to PYW, click [Advanced]

You should get an "Edit File Type" dialog. Mine shows just one
action "open", yours probably has "open" and "edit". Select "edit" and
then click [Edit] button. See what it says for the application to be
used.

Do the same on the Win7 machine -- it probably doesn't have "edit"
as an action, so you'll be picking the [New] button. Define the new
action to look like the action on the laptop (use the correct path to
the python executable, and maybe to IDLE).

Heck, check what those actions show for PY files too... The only
difference between PY and PYW should be the application used in the
"open" action.
PY => .../python.exe
PYW => .../pythonw.exe

Also make sure that the "open" action is the defined default (select
the action, and click the default button); when there are more than one
action, the default will be in bold.
 
W

W. eWatson

Are you using the vanilla installer or ActiveState's ActivePython? I
find the latter integrates better with Windows.

Also, out of curiousity, 32 or 64 bit Windows?
64-bit and plain old python msi installer.
 
B

Benjamin Kaplan

Because some  people think that's a solution, and ask. It's not. It leads to an error message.


Checking my Python install, there should be an idle.bat file in there
too. Have you tried that?
 
A

alex23

Because some  people think that's a solution, and ask. It's not. It
leads to an error message.

No, people are saying "manually add IDLE _the correct way that Windows
can recognise_", not recommending you stuff random .pyw files into the
context menu and hope they work.
 
T

Terry Reedy

I have not found any successful way to get to IDLE.

Use the start menu to start IDLE once. Then pin it to your taskbar.
If you do not have STart/ all programs / Python / IDLE, then your
installation is bad.

As for the right click problem, you probably have something screwy in
the registry. The python installer (or uninstaller) will not fix it (my
experience on my old xp machine). You will have to do so manually.
 
N

Neil Cerutti

Sounds like a good idea except I've not used associations in so
long under XP, I have no idea where to start. Control Panel. My
Computer Tools?

Open Windows Explorer.
With the menu, to to Tools->Folder Options
Click the File Types tab in the Folder Options menu.

There will be an upper view with registered filed types, and some
buttons below far making changes to them.
 
W

W. eWatson

Open Windows Explorer.
With the menu, to to Tools->Folder Options
Click the File Types tab in the Folder Options menu.

There will be an upper view with registered filed types, and some
buttons below far making changes to them.
OK, I've found that. I see
Py
Pyc
Pyo
Pyw
If I click on each, it basically it gives a short description of each.
If I click advanced, there's more info. For example for py, Actions are
IDLE and Open.

What does this tell me that's relevant to Win7?

If on Win7, I go to Default Programs I see under associations various
python items. Py shows Unknown application. Since installing 2.7.2 I
have not messed with these associations. If I right-click on Unknown, I
see Notepad and python.exe for choices to open the file. I want neither.
Why isn't IDLE listed there?

If I right-click on junk.py, I see "Open with". Notepad and python.exe
are choices. However, that menu allows me to choose something else. For
example, Adobe Reader, or Internet Explorer. I suppose the next question
is should I use the browse there and try to connect to IDLE in
....\Lib\idlelib? My guess is that if I do, I will run into the "invalid
Win32 app", when I try to use it.
 
W

W. eWatson

Months ago 2.5.2 stopped functioning on my Win7 PC, so a few days ago I
uninstalled and installed. Same problem. If one right-clicks on a py
file, IDLE is not shown in the menu as Edit with IDLE. After playing
with matters I gave up, and uninstalled 2.5.2 and turned to 2.7.2. Same
results.

If I look at a 2.4 install on my laptop, I get the desired reference to
Edit with IDLE.
Fine... so open a directory window, follow

Tools/Folder Options/File Types

Scroll down to PYW, click [Advanced]

You should get an "Edit File Type" dialog. Mine shows just one
action "open", yours probably has "open" and "edit". Select "edit" and
then click [Edit] button. See what it says for the application to be
used.

Do the same on the Win7 machine -- it probably doesn't have "edit"
as an action, so you'll be picking the [New] button. Define the new
action to look like the action on the laptop (use the correct path to
the python executable, and maybe to IDLE).

Heck, check what those actions show for PY files too... The only
difference between PY and PYW should be the application used in the
"open" action.
PY => .../python.exe
PYW => .../pythonw.exe

Also make sure that the "open" action is the defined default (select
the action, and click the default button); when there are more than one
action, the default will be in bold.





My guess is that Win 7 is behind this. If so, it's good-bye Python.

Comments?
See my response to Neil Cerutii a few msgs above this one.
 
W

W. eWatson

Months ago 2.5.2 stopped functioning on my Win7 PC, so a few days ago I
uninstalled and installed. Same problem. If one right-clicks on a py
file, IDLE is not shown in the menu as Edit with IDLE. After playing
with matters I gave up, and uninstalled 2.5.2 and turned to 2.7.2. Same
results.

If I look at a 2.4 install on my laptop, I get the desired reference to
Edit with IDLE.
Fine... so open a directory window, follow

Tools/Folder Options/File Types

Scroll down to PYW, click [Advanced]

You should get an "Edit File Type" dialog. Mine shows just one
action "open", yours probably has "open" and "edit". Select "edit" and
then click [Edit] button. See what it says for the application to be
used.

Do the same on the Win7 machine -- it probably doesn't have "edit"
as an action, so you'll be picking the [New] button. Define the new
action to look like the action on the laptop (use the correct path to
the python executable, and maybe to IDLE).

Heck, check what those actions show for PY files too... The only
difference between PY and PYW should be the application used in the
"open" action.
PY => .../python.exe
PYW => .../pythonw.exe

Also make sure that the "open" action is the defined default (select
the action, and click the default button); when there are more than one
action, the default will be in bold.





My guess is that Win 7 is behind this. If so, it's good-bye Python.

Comments?
See my response to Neil Cerutti a few msgs above this one.
 
M

MRAB

OK, I've found that. I see
Py
Pyc
Pyo
Pyw
If I click on each, it basically it gives a short description of each.
If I click advanced, there's more info. For example for py, Actions are
IDLE and Open.

What does this tell me that's relevant to Win7?

If on Win7, I go to Default Programs I see under associations various
python items. Py shows Unknown application. Since installing 2.7.2 I
have not messed with these associations. If I right-click on Unknown, I
see Notepad and python.exe for choices to open the file. I want neither.
Why isn't IDLE listed there?

If I right-click on junk.py, I see "Open with". Notepad and python.exe
are choices. However, that menu allows me to choose something else. For
example, Adobe Reader, or Internet Explorer. I suppose the next question
is should I use the browse there and try to connect to IDLE in
...\Lib\idlelib? My guess is that if I do, I will run into the "invalid
Win32 app", when I try to use it.
You can't associate .py with Idle because Idle is a Python script, not
an executable (an .exe).

Have a look here:
http://superuser.com/questions/6885...ntext-menu-action-for-jpg-and-other-image-fil

In my PC's registry (Windows XP, but Windows 7 should be similar or the
same) it has the entry:

Key: HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command
Value: "C:\Python31\pythonw.exe" "C:\Python31\Lib\idlelib\idle.pyw" -n
-e "%1"

Note how it actually associates the Edit action of Python files with an
..exe file.
 
R

rusi

You can't associate .py with Idle because Idle is a Python script, not
an executable (an .exe).

Have a look here:http://superuser.com/questions/68852/change-windows-7-explorer-edit-c...

In my PC's registry (Windows XP, but Windows 7 should be similar or the
same) it has the entry:

Key: HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command
Value: "C:\Python31\pythonw.exe" "C:\Python31\Lib\idlelib\idle.pyw" -n
-e "%1"

Note how it actually associates the Edit action of Python files with an
.exe file.

The tools -> folder options approach is the user-friendly approach --
when it works.
The 'Correct the registry' is the muscular approach -- it will set
right everything iff you are a wizard.

In between the two is assoc and ftype see
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ftype.mspx?mfr=true
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/assoc.mspx?mfr=true
 
W

W. eWatson

You can't associate .py with Idle because Idle is a Python script, not
an executable (an .exe).

Odd, but OK.
Are you suggesting that I use the "default" program mentioned there?
In my PC's registry (Windows XP, but Windows 7 should be similar or the
same) it has the entry:

Key: HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command
Value: "C:\Python31\pythonw.exe" "C:\Python31\Lib\idlelib\idle.pyw" -n
-e "%1"

Note how it actually associates the Edit action of Python files with an
.exe file.
So pythonw.exe and idle.pyw are not scripts but somehow can fire up idle?

Are you suggesting I modify my registry? I still find it bizarre the
install did not put it IDLE choice on the menu for py. It's there on XP.
 
W

W. eWatson

The tools -> folder options approach is the user-friendly approach --
when it works.
The 'Correct the registry' is the muscular approach -- it will set
right everything iff you are a wizard.

In between the two is assoc and ftype see
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ftype.mspx?mfr=true
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/assoc.mspx?mfr=true
These two seem equally muscular. I shudder to think where these choices
might lead me.
 
W

W. eWatson

Use the start menu to start IDLE once. Then pin it to your taskbar.
If you do not have STart/ all programs / Python / IDLE, then your
installation is bad.

As for the right click problem, you probably have something screwy in
the registry. The python installer (or uninstaller) will not fix it (my
experience on my old xp machine). You will have to do so manually.
IDLE is a choice on the Start menu (All Programs). Pressing it does
nothing. I see nothing that suggests it's open.

The IDLE entry is pointing at c:\Python27\ (shortcut)

A post above yours suggests IDLE is a script, and somehow needs a
"boost" to use it. An exe file, apparently. Beats the heck out of me.
 
D

Dennis Lee Bieber

OK, I've found that. I see
Py
Pyc
Pyo
Pyw
If I click on each, it basically it gives a short description of each.
If I click advanced, there's more info. For example for py, Actions are
IDLE and Open.

What does this tell me that's relevant to Win7?
If you hit the "edit" button for each of those actions, it should
show you the ACTUAL application that performs that action.

Duplicate that definition on Win7 (using the correct path to the
files if they are different).
If on Win7, I go to Default Programs I see under associations various
python items. Py shows Unknown application. Since installing 2.7.2 I
have not messed with these associations. If I right-click on Unknown, I
see Notepad and python.exe for choices to open the file. I want neither.
Why isn't IDLE listed there?

"python.exe" should be the default for open -- that's how you get a
double-click on a file to actually RUN it. For script files, editing
should be a separate "edit with ..." action.

And at this point, who cares why you don't see IDLE listed -- we've
been spending half the week trying to tell you HOW to add it.

Since I had a registry corruption, I don't even have PYO and PYC
files listed, and PYW did not have an edit action. I've since added
"edit with Pythonwin" and, just for you, added an "edit with IDLE"
action. I did it the long way around, invoking the exe with IDLE as the
argument...

So... once again...

-=-=-=-=-=-
Tools/File Options/File Types

For each of PY and PYW that don't have an edit action:
[New]

{give it a name -- note that I leave "open" to RUN the file only}
edit with IDLE

{application used... change the path to match your installation; keep
the quotes}
"E:\Python25\pythonw.exe" "E:\Python25\Lib\idlelib\idle.pyw" "%1"

{I don't know if the next are significant}
[X] Use DDE

{Application}
IDLE

{save the changes}
[OK]
[OK]
[Close]
-=-=-=-=-=-

After doing the above, the <right-click> menu would show "edit with
IDLE" as a choice.

I'd also suggest obtaining a copy of "Windows 7 Inside Out" --
though it appears to have skipped the detailed file type action
definitions (no wonder -- if my laptop with Win7 Home Premium is any
example, MicroSloth /removed/ the ability to add multiple actions --
there is NO "tools/file options/file types" visible. That leaves using
the registry editor to add the actions.

My Win7 machine has the following entries (export from regedit):

-=-=-=-=-=-
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.py]
@="Python.File"
"Content Type"="text/plain"

[HKEY_CLASSES_ROOT\.pyw]
@="Python.NoConFile"
"Content Type"="text/plain"

HKEY_CLASSES_ROOT\Python.File]
@="Python File"

[HKEY_CLASSES_ROOT\Python.File\DefaultIcon]
@="C:\\Python27\\DLLs\\py.ico"

[HKEY_CLASSES_ROOT\Python.File\shell]

[HKEY_CLASSES_ROOT\Python.File\shell\EditWithPythonwin]
@="Edit with &Pythonwin"

[HKEY_CLASSES_ROOT\Python.File\shell\EditWithPythonwin\command]
@="\"C:\\PYTHON~1\\Lib\\SITE-P~1\\PYTHON~1\\PYTHON~1.EXE\" \"%1\" %*"

[HKEY_CLASSES_ROOT\Python.File\shell\open]
@="Open"

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

[HKEY_CLASSES_ROOT\Python.NoConFile]
@="Python File (no console)"

[HKEY_CLASSES_ROOT\Python.NoConFile\DefaultIcon]
@="C:\\Python27\\DLLs\\py.ico"

[HKEY_CLASSES_ROOT\Python.NoConFile\shell]

[HKEY_CLASSES_ROOT\Python.NoConFile\shell\EditWithPythonwin]
@="Edit with &Pythonwin"

[HKEY_CLASSES_ROOT\Python.NoConFile\shell\EditWithPythonwin\command]
@="\"C:\\PYTHON~1\\Lib\\SITE-P~1\\PYTHON~1\\PYTHON~1.EXE\" \"%1\" %*"

[HKEY_CLASSES_ROOT\Python.NoConFile\shell\open]
@="Open"

[HKEY_CLASSES_ROOT\Python.NoConFile\shell\open\command]
@="\"C:\\Python27\\pythonw.exe\" \"%1\" %*"
-=-=-=-=-=-

In contrast, my WinXP system shows (just for .PY, and with the above
add for IDLE):

-=-=-=-=-=-
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.py]
@="py_auto_file"

[HKEY_CLASSES_ROOT\.py\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\py_auto_file]
@=""
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008

[HKEY_CLASSES_ROOT\py_auto_file\shell]
@="open"

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit]

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit\command]
@="\"E:\\Python25\\Lib\\site-packages\\pythonwin\\Pythonwin.exe\"
\"%1\""

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit_with_IDLE]
@="edit with IDLE"

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit_with_IDLE\command]
@="\"E:\\Python25\\pythonw.exe\"
\"E:\\Python25\\Lib\\idlelib\\idle.pyw\" \"%1\""

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit_with_IDLE\ddeexec]

[HKEY_CLASSES_ROOT\py_auto_file\shell\edit_with_IDLE\ddeexec\Application]
@="Idle"

[HKEY_CLASSES_ROOT\py_auto_file\shell\open]

[HKEY_CLASSES_ROOT\py_auto_file\shell\open\command]
@="\"E:\\Python25\\python.exe\" \"%1\" %*"
-=-=-=-=-=-
 
S

Stephen Hansen

64-bit and plain old python msi installer.

That'd be it, I expect.

Windows has two parallel registry trees; if you launch a 32-bit program,
it sees one.. if you launch a 64-bit program, it sees the other. What
looks like the exact same keys can be different as a result.

The MSI is probably writing the keys into the 32-bit registry, and
Explorer is now a 64-bit application.

You can add the associations for Edit manually. Though not to
"idle.pyw", which you keep -- repeatedly -- saying you try and errors.
Of course it errors. That's a python script, not an executable.

Associate to pythonw.exe, and pass it the path to idle.pyw, and then -n
-e "%1" -- which will be replaced with the actual filename. But you were
told that already and seem to have just dismissed it out of hand.

Like: PATH\pythonw.exe PATH\idle.pyw -n -e "%1"

... where PATH is whatever the location of those files are in your
environment.

Yes, its moderately annoying that you have to do this yourself; maybe
you wouldn't if you installed 64-bit python, but I can't be sure. Maybe
it has nothing to do with 32 or 64-bitness at all and my guess is wrong.
Maybe your profile has gone wonky. But it doesn't matter. You can add
the Edit association yourself. Its a one-time fix.

--

Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog: http://meh.ixokai.io/


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)

iQEcBAEBAgAGBQJOxtzdAAoJEKcbwptVWx/lF6cH/RqbEL8YHo5sPJ1OHfP71A5G
tj/iYmcHdd406UPDYzlt7DgwrJ8UgDNIsKtd6mk2ju4UcPfme/pAQ/fXyAdCLfEQ
pX9pXvb53tRrgD7HDEDPUAPevVCIfAMnkrOLdU7ffui3l3Gt5zFMI0l5YK0zDs59
RqrN4/T8McUW9Z9wN0dRa/O/xdzbvAIiNEEtomYhdiK/sB1L95saMjStvTQdv86n
TAAZeiz4InL3O6D6BbOSzG/6f+pPg4iBPjGzNbbM70S+laCgIi+YJs4UsVKCTw3G
WPgg3WmvVcZ/ZLBks58Gs4lMymvOXiFNim4f87XLC9BANlia+ulNlAhyPuz7FrI=
=Iq91
-----END PGP SIGNATURE-----
 
D

Dennis Lee Bieber

So pythonw.exe and idle.pyw are not scripts but somehow can fire up idle?
All .py and .pyw are scripts (.pyw is a "code" that this script
should NOT open a standard console window).

pythonw.exe is the python executable that is meant to be used to run
..pyw scripts (python.exe is the default for .py files, and will create a
console window if it can not find stdin/stdout/stderr from its own
environment; pythonw.exe does not open a console window regardless)
Are you suggesting I modify my registry? I still find it bizarre the
install did not put it IDLE choice on the menu for py. It's there on XP.

Who can say? Maybe M$ security prevents some of those registry
changes from sticking...
 
A

alex23

Yes, its moderately annoying that you have to do this yourself; maybe
you wouldn't if you installed 64-bit python, but I can't be sure. Maybe
it has nothing to do with 32 or 64-bitness at all and my guess is wrong.

I've got the 32 bit version of 2.7 & the 64 bit of 3.2 installed under
Windows 7. I'm not seeing 'Edit with IDLE' options, instead I get
'Edit with Pythonwin' from the 32bit installation.

I'm also using ActivePython, though. I can honestly say I've never had
an issue under Windows with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top