if stat.S_ISDIR(entry[1][0]): elif stat.S_ISREG(entry[1][0]):This illegal, you need to do something between the if and elif
as a temporary measure, you could use pass than add code later when you know what you want to do
you can query stat.S_ISREG directly, don't need to check for ISDIR unless you need to know:
if stat.stat.S_ISREG(entry[1][0]): do something