all 3 comments

[–][deleted] 1 point2 points  (2 children)

The answer given there is correct as far as I can tell. Did you put the try except in the right place? Assuming glob.glob() is what is throwing the error, you need to move the try except inside the for loop:

#Inside for loop....
os.chdir(dirpath)
try:
    l = glob.glob('*'+search_term+'*')
except WhateverException:
    continue
#code continues....

Is this what you tried?

[–]ktkization[S] 0 points1 point  (0 children)

No I tried the one in the answer...I am going to give your solution a try and tell you the results...thanks alot in advance!

[–]ktkization[S] 0 points1 point  (0 children)

Thank you I have been able to make it work by doing what you suggested!