Cannot find text in *.py files with Windows Explorer?

Gabriel Genellina gagsl-py2 at
Mon Apr 6 07:52:13 CEST 2009

En Sun, 05 Apr 2009 16:36:05 -0300, Gerhard Häring <gh at>  
> John Machin wrote:
>> On Apr 4, 3:21 pm, John Doe <j... at usenetlove.invalid> wrote:
>>> Anybody have a solution for Windows (XP) Explorer search not finding
>>> ordinary text in *.py files?
>> Get a grep on yourself!
> There's something even better:

Both have the same problem: they scan the "bytes contained in the file",  
not the "textual information available from the file".
If you want to search for "año", grep won't find it if the file is stored  
in utf-8 and your terminal is latin1, or inside an HTML document written  
as a&ntilde;o, and may have some trouble if the file is in utf-16. In some  
cases, grep may not find any text inside a PDF document (when it's  

The standard Windows search, on the contrary, does not have those  
limitations: but you have to "tell" it how to extract textual info from  
unknown file sources; in this case, that .py files are plain text files.

This KB article [1] explains how to do that for .py files, and this [2]  
the underlying technology.


Gabriel Genellina

More information about the Python-list mailing list