Python is easy?

Patrick Ellis pellis at tampabay.rr.com
Thu Aug 15 23:26:08 EDT 2002


"Bengt Richter" <bokr at oz.net> wrote:
> Here's a recipe to give you a right-click popup menu item called
> "Run in Persistent Console" in the explorer for NT4:
>
> run regedt32
> <snip>
>         Run in Persistent Console
>             command
>                 Data: cmd.exe /x /k D:\Python22\python.exe "%1"

Rather than using regedit, I use an option in Explorer for this. In the
menus, under view or tools, there is an "options...", "file options...", or
"folder options..." selection, depending on Windows version. It will pop up
a tabbed window. Select the File Types tab and you get a list of the file
types. Scroll down to Python and hit edit to get a GUI to edit the same
settings you did via the registry. I had already setup an edit option that
went to my preferred editor, similar to the Edit with Idle option. I used it
to add your suggested option, and it works great.

One thing to be careful of, the "open" option listed here is also used when
you type test1.py on the command line. The reason the .py is required is so
that it can lookup the file type. Changing it to the above would result in
recursive invocations of cmd.exe whenever you ran a Python script. What I'll
try, when I get to work tomorrow, is make the new Run in Persistent Console
the default action (just a button click in the file type window) and make
sure the command line sticks with open and not the new default action.

> Thanks for asking, or I wouldn't have gotten this set up for myself ;-)

Glad to be of service to the Python community. I probably could have figured
it out myself, but it somehow seemed more Pythonic to get someone else to do
it for me ;-). Hey, I just found a fault in Python. Having such a large
library of code promotes laziness and sloth. Leave to the Dutch to put so
much work into corrupting the world's youth ;-).

I'm not sure what that last sentence means, but it makes me smile and I'm
keeping it.

> If you want the double click to act that way, then you could just modify
> the command line for it the same way, prefixing cmd.exe /x /k (I like the
> /x extensions, but /k is all you need to keep the console window).

The help says that /x is on by default in NT4.





More information about the Python-list mailing list