[Tutor] Help on python file extension windows vista recognition

Dave Angel davea at ieee.org
Mon Oct 12 22:32:30 CEST 2009


Victor Binns wrote:
>  
>
> Please,
> I need help. I installed python on my gateway windows vista laptop computer.
>  
> This is with the latest version of python (Python 2.6.3 Windows installer)
> Python 2.6.3 Windows installer
>   
It's not the latest, but no problem. It's probably a good choice.
>  
> I have some python code files I placed on my desktop and tried placing it in a folder containing
> python program.
>   
Which?  On the desktop, or in a folder containing python programs?
>  
> The files still appears on the computer as a text file.  Even though I placed the .py file extension on the file.
>  
> The .py is on the file but the icon image appears as a notepad file.
>  
> I need help in resolving this issue.
>  
> Thanks
>
>  		 	   		  
>
>   
Are you familiar with your system, and with Vista in particular?  One 
thing that's  been wrong for the last few implementations of Windows is 
that by default Explorer hides the extension of files.  So you have to 
believe in icons to guess what the file extension is.  When I get each 
new system, one of the first things I change is "hide file extensions 
for known types".  Don't hide anything.  There are a number of other 
foolish settings which ought to be switched, but this is one of the most 
important.

Most likely, your base problem is that your file is called

     myprogram.py.txt

Notepad loves to add a txt extension to files, and by default Windows 
Explorer obscures that fact.  If you must use Notepad to edit the files, 
then when doing the SaveAs, make sure you change the "Save as file 
type"  from "Text Documents" to "All files"  Otherwise Notepad will add 
an extra .txt to whatever extension you try to use.

You will also need to get comfortable with the DOS box (Command Prompt,  
whatever Vista calls it.  It's probably in Start->Accessories).  In a 
DOS box, you could do a DIR of that directory, and see exactly what the 
file is called.  You also could invoke python or pythonw explicitly on 
the file, with extra option switches.  And when the program finishes, 
the window with the result wouldn't automatically vanish.  And you can 
scroll back and see what's been happening in previous runs.  And you can 
actually type arguments to your script.  And ...

DaveA



More information about the Tutor mailing list