Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Complete frustration

0 views
Skip to first unread message

hellcats

unread,
May 8, 2009, 4:45:11 PM5/8/09
to
I have Python2.5 installed on Windows XP. Whenever I double click on a
something.pyw file, IDLE launches and opens something.pyw in the
editor. I would prefer to actually *RUN* the program, not edit it. If
I want to edit it then I'll choose the "Edit with IDLE" context menu.
So I then have to press F5 to get the program to execute. Now I have
my program's windows along with two IDLE windows cluttering my screen
and task bar. WHAT IS GOING ON? I've tried changing the file
association to python.exe, and that works, but just ONCE (even if I
choose "always use the slected program to launch this kind of file").
IDLE may be great and all, but I fricken' don't want to see it every
time I just want to run a python program!!!!!

Emile van Sebille

unread,
May 8, 2009, 5:18:44 PM5/8/09
to pytho...@python.org
On 5/8/2009 1:45 PM hellcats said...
> --
> http://mail.python.org/mailman/listinfo/python-list
>
This is a windows question -- you'll need to reassign the default
association of PYW files. Look in explorer|tools|folder options.

Emile

hellcats

unread,
May 8, 2009, 6:08:16 PM5/8/09
to

I know that. I've tried reassigning it from pythonw.exe to python.exe,
and like I said, it will work for one invocation. But it seems to
revert back the next time I double click. But also, what is wrong with
it being pythonw.exe? Why does pythonw.exe open up IDLE?

Scott David Daniels

unread,
May 8, 2009, 6:37:09 PM5/8/09
to

Try opening up a command window, and determine the current associations.
If I do this on mine:
C:\Projects> assoc .pyw
.pyw=Python.NoConFile

C:\Projects> ftype Python.NoConFile
Python.NoConFile="C:\Python31\pythonw.exe" "%1" %*

It is possible you installed something that switched those settings.

--Scott David Daniels
Scott....@Acm.Org

Emile van Sebille

unread,
May 8, 2009, 6:36:17 PM5/8/09
to pytho...@python.org
On 5/8/2009 3:08 PM hellcats said...

> On May 8, 4:18 pm, Emile van Sebille <em...@fenx.com> wrote:
<snip>

>> This is a windows question -- you'll need to reassign the default
>> association of PYW files. Look in explorer|tools|folder options.
>>
>> Emile
>
> I know that. I've tried reassigning it from pythonw.exe to python.exe,
> and like I said, it will work for one invocation. But it seems to
> revert back the next time I double click. But also, what is wrong with
> it being pythonw.exe? Why does pythonw.exe open up IDLE?

When you right click your source file, do you have an 'open with' python
option? Does that do the right thing? If so, you're fighting your
windows installation which is where you'll need to address this problem.

You might try downloading and installing the activestate python
distribution (assuming you're not already there). That will likely set
your windows registry appropriately.

Emile

Casey Hawthorne

unread,
May 8, 2009, 6:59:28 PM5/8/09
to
On Fri, 08 May 2009 14:18:44 -0700, Emile van Sebille <em...@fenx.com>
wrote:

>On 5/8/2009 1:45 PM hellcats said...

I believe this option is in the Python init file!
--
Regards,
Casey

hellcats

unread,
May 8, 2009, 7:20:52 PM5/8/09
to

Thanks everyone for the suggestions. I played with the registry a
little bit. It looks like I had Python2.6 installed at one point, so
maybe that corrupted things. I uninstalled everything and reinstalled
Python2.5 (but without Tk/Tcl) and now double clicking a .pyw runs the
program without IDLE or the MSDOS window showing up (as I had hoped).
So I am happy now. Thanks again.

Emile van Sebille

unread,
May 8, 2009, 8:03:34 PM5/8/09
to pytho...@python.org
On 5/8/2009 3:59 PM Casey Hawthorne said...

> On Fri, 08 May 2009 14:18:44 -0700, Emile van Sebille <em...@fenx.com>
<snip>

>> This is a windows question -- you'll need to reassign the default
>> association of PYW files. Look in explorer|tools|folder options.
>>
>> Emile
>
> I believe this option is in the Python init file!

As in part of site? Such that invoking "python.exe myfile.py" turns it
around and invokes idle myfile.py?

Who knew? :)

Emile

Scott David Daniels

unread,
May 8, 2009, 8:39:33 PM5/8/09
to

You probably can have Tk/Tcl there, I suspect something like VPython
or the 2.6 and remove it caused the problem. By the way, it is safe
to simply uninstall-reinstall a python .msi in order to make that
version of python be the default. uninstalling only removes that
which it installs, so after a reinstall, your other libraries are
still safely there.

--Scott David Daniels
Scott....@Acm.Org

norseman

unread,
May 11, 2009, 1:06:28 PM5/11/09
to hellcats, pytho...@python.org
> --
> http://mail.python.org/mailman/listinfo/python-list
>
------------------------
I agree completely. Check the Python-List archives. Look for a file
that is dated July 8, 2008 (07/08/2008) that was sent by norseman.

It works for me.


Steve

Dave Angel

unread,
May 11, 2009, 8:30:37 PM5/11/09
to norseman, pytho...@python.org, hellcats

norseman wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">hellcats

>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
> ------------------------
> I agree completely. Check the Python-List archives. Look for a file
> that is dated July 8, 2008 (07/08/2008) that was sent by norseman.
>
> It works for me.
>
>
> Steve
>

> </div>
For a Unix person, you sure act like you know Windows. But changing the
PATH environment variable affects a command typed in the shell, but does
not affect what happens when you either type the name of a python script
directly, or when you double-click on such a file. That's controlled by
file associations. (PATH isn't the answer in Unix either, most shells
use the shebang at the beginning of the script.)

File associations can be controlled in a number of ways. OPEN-WITH is
one way. REGEDIT is another. In fact, any program can modify these
settings, including your own scripts. Something is changing things back
on you. But once you're having the problem of things reverting
"automatically," a command line tool is sometimes the easiest.

Two built-in commands (they're inside the cmd.exe shell) can help.
They're ASSOC and FTYPE

Since the extension you're bothered by is .pyw, try the following:

C:> assoc .pyw
.pyw=Python.NoConFile

C:> ftype Python.NoConFile
Python.NoConFile="C:\ProgFiles\Python26\pythonw.exe" "%1" %*


Type them once and copy/paste results somewhere.

Then fix the problem, and look again. Check that they work by
double-clicking a xxx.pyw file in Explorer.

Now, run other things, especially IDLE, and recheck these two commands
to see if something changed. If it did, then blame whatever program you
just ran.

My guess is that it changed when some Python installation was done. And
some programs have a habit of continually resetting their own
associations. Sometimes this is configurable, sometimes you just have
to stop using the brain-dead program.

Notes: your path is unlikely to be the same as mine, so replace the
C:\ProgFiles... string as appropriate to your preferred Python version
location. Note you want Pythonw.exe, or you'll wind up with an extra
shell window. You can do the same thing for the .py extension, which
should wind up running python.exe. And you can make a simple two-line
batch file to set these (assoc/ftype). If you had several such batch
files you could change the default python very easily. Unlike
environment variables, these associations are global, across all users,
across all applications. So changes made in one shell affect any other
shells, as well as the Explorer windows.

Final note: once you've got these right, you can run a script in the
obvious way (like Unix).
myprogram.py parm1 parm2
will actually run python.exe myprogram.py parm1 parm2

And if you add a .PY and .PYW to PATHEXT environment variable, you can
just run
myprogram parm1 parm2
without any extension on the script name. This should normally be done
in the Control Panel->Environment vars so it'll work in multiple DOS
boxes, same as all environment variable changes.

Tim Golden

unread,
May 12, 2009, 3:26:37 AM5/12/09
to pytho...@python.org
Dave Angel wrote:

[... snip sound advice about file associations etc. ...]

One thing to bear in mind is that any settings, however obtained,
in the User part of the registry (HKCU\Software\....) will override
those in the Machine part of the registry (HKLM\Software...). If
you think you've set things correctly and you're still not seeing
the effect, check under HKCU to see if there's something there
which would override things.

TJG

0 new messages