Error with my Python File Search Algorithm <p>I have a problem with my python code.When my search code encounters an error it terminates the search it is conducting even when it has not yet finish searching a specific location. This mostly happens when it encounters a write protected folder or file.I am using <code>os.walk()</code> for transversing the file system tree and <code>glob.glob()</code> module to perform the searches How do i deal with this issue?</p> <p>Here is part of my code:</p> <pre><code>def searchEntity(drive,search_term): f_files={} print 'Searching in %s ........' %drive try: for dirpath,dirname,filename in os.walk(drive): os.chdir(dirpath) l=glob.glob('*'+search_term+'*') for e in l: self.f_files[e]=dirpath print e except Exception,e: print e finally: print'&lt;&lt;Search Completed&gt;&gt;' </code></pre> <p>How can i skip this write protected locations and continue with the search or should i use a better searching method. Here is an example of the error i am receiving:<br /></p> <p>Searching in <code>C:/ ........</code><br /> <code>[Error 5] Access is denied: 'C:/Program Files\\Microsoft SQL Server\\110\\Shared\\ErrorDumps'</code></p>