os.walk() silently produces an empty iterator if the argument is not a path to directory:
>>> import os
>>> list(os.walk('./non-existing'))
[]
>>> list(os.walk('./python'))
[]
>>> list(os.walk('/dev/null'))
[]
It can causes bugs like #99203, when a function produces some incorrect result instead of raising an exception.
os.walk()silently produces an empty iterator if the argument is not a path to directory:It can causes bugs like #99203, when a function produces some incorrect result instead of raising an exception.