I'm using os.walk
with followlinks=True
, but I hit a place where a symbolic link refers to it's own directory, causing an infinite loop. The culprit in this case is /usr/bin/X11
which list listed as follow :
lrwxrwxrwx 1 root root 1 Apr 24 2015 X11 -> .
Is there any way to avoid following links to either .
or ..
which I would assume, would cause similar problems? I think I could check this with os.readlink
then compare against the current path. Is there any other solution for this?
a -> b
andb -> a
? – Eustatius