Python 3 minor irritation

Gabriel Genellina gagsl-py2 at
Fri Feb 5 01:03:20 CET 2010

En Thu, 04 Feb 2010 17:50:29 -0300, Gib Bogle  
<g.bogle at> escribió:
> Gabriel Genellina wrote:

>>  Also, from the command line, execute:
>>  D:\temp>reg query HKCR\.py
>>     <Sin nombre>        REG_SZ  Python.File
>>     Content Type        REG_SZ  text/plain
>>  HKEY_CLASSES_ROOT\.py\PersistentHandler
> I'm interested in this, because I'm using Windows XP, and when I execute  
> this command I see the first part but not the second (with  
> PersistentHandler).

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  

> 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: )

Gabriel Genellina

More information about the Python-list mailing list