Python is easy?

Bengt Richter bokr at oz.net
Fri Aug 16 09:37:07 CEST 2002


On Fri, 16 Aug 2002 03:26:08 GMT, "Patrick Ellis" <pellis at tampabay.rr.com> wrote:

>"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.
>
You are right, using that is much better advice. Editing the registry can be
dangerous.

>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
you mean one level of recursion, as when typing xxx.py in a cmd console window,
I assume. Yes that would get annoying. I knew there was some reason I didn't
change the main mechanism for myself, though I mentioned the possibility ;-)

Even Steve Holden's suggestion of python -i might not be ideal for default open.

>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.
>
Please post what you wind up doing.

>> 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).
>
On reading that again, I'm not sure it's a good idea to change the default
double click open action at all. Too different from standard usage. I like the
right click option though.

>The help says that /x is on by default in NT4.
You're right. I'm trying to remember when I started adding /x (not that it's
that often ;-). Maybe it wasn't default when I installed NT3.51?

Regards,
Bengt Richter



More information about the Python-list mailing list