Python 3 minor irritation

Gib Bogle g.bogle at auckland.no.spam.ac.nz
Thu Feb 4 19:21:07 EST 2010


Gabriel Genellina wrote:

> Sorry, I should have removed that line. This is just my setup; a normal 
> Python install doesn't create that registry entry. It allows Desktop 
> Search (or Windows Search, or whatever it is called nowadays; the F3 
> key) to search inside .py files (default behavior is to just ignore 
> their contents).
> See http://support.microsoft.com/kb/309173
> 
>> Is this related to the fact that when I double-click on a .py file the 
>> command window disappears after the execution is completed?
> 
> (I bet the "Persistent" word confused you.) No, as you can see, it's 
> completely unrelated. AFAIK, there is no way (on XP and later at least) 
> to keep a console window open after the program exited. Three choices:
> 
> - Open a cmd window and execute the script there. You may drag&drop the 
> file over the window to avoid typing the full path (I think this last 
> part does not work on Vista nor Win7)
> 
> - Add a raw_input() [2.x] or input() [3.x] line at the end of the script
> 
> - Rename it with a '.cmd' extension and add this line at the very top:
> 
>     @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
> 
> (see this post by Duncan Booth last month:
> http://comments.gmane.org/gmane.comp.python.general/650913 )
> 

Thanks Gabriel.  I didn't know about the drag&drop capability (learn something 
every day, forget two things).  BTW input() works for me in 2.5.
Cheers
Gib



More information about the Python-list mailing list