[Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

Marc Tompkins marc.tompkins at gmail.com
Tue Nov 15 23:27:57 CET 2011


On Tue, Nov 15, 2011 at 12:19 PM, Wayne Watson <sierra_mtnview at sbcglobal.net
> wrote:

>
>  For py, I found \Python25\Lib\idlelib\idle.**pyw.
>>>
>>>  Does no good to specify yet another .py file as the executable.  You
>> must specify a .EXE file (or .BAT, or .CMD, or very rarely, a .COM file).
>>
> In py land I only have py, pyc, pyw, and pyo. I've now done py and pyc as
> default. Still have the same Win32 app problem.
> What am I supposed to do with python.exe? It will open a DOS window with a
> command >>> prompt. I can use the prompt to do arithmetic.
>
> Tried idle.bat moments ago. Still get Win32 app problem msg on py files.


I'm going to try one last time before I give up:

- Go to Control Panel\Programs\Default Programs\Set Associations.
- Highlight the line for ".py"
- Click "Change program..."
- In the "Open with" dialog, click the "Browse..." button.
- In the "Open with..." dialog, navigate to C:\Python25\Lib\idlelib
- Highlight "idle.bat"
- Click the "Open" button.
- You'll be back in the "Open with" dialog.  Click OK.

If you - yet again - do something other than what I've just described, and
then reply telling me that it didn't work, I will add you to my spam
filter.

You asked about the %1 %2 %3 etc. in idle.bat.  Yes, those are arguments.
>From now on, when you double-click on a .py file,
- Windows will run idle.bat and pass it the name of your .py file as its
first (and only) argument.
- Idle.bat will then run pythonw.exe with "idle.pyw" as its first argument,
and the name of your .py file as its second argument.
- Python will then run IDLE with your .py file as its first argument.

I'm going to underscore this one more time, because you need to understand
it: Python is an interpreted/scripting language, and (except for specialty
extensions like Pyrex) it does NOT compile into standalone executables.*
Windows cannot run Python code directly - Windows doesn't know what Python
is.  When you double-click on a Python file and expect Windows to do
something with it, you have to tell Windows to open it with a program that
Windows actually CAN run directly - in this case, idle.bat.  What you've
been telling Windows to do, by associating .py files with idle.pyw, is to
open one file it doesn't recognize by using another file it doesn't
recognize.  Don't do that.


* Installation bundlers like Py2EXE or GUI2EXE simply create a minimal
bundle of the Python interpreter and put it in (essentially) a
self-extracting Zip file.  Yes, the result is an executable - usually a
gigantic one - but it's not "compiling" in the usually-understood meaning
of the word.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111115/8838472a/attachment.html>


More information about the Tutor mailing list