"Maximum recursion depth exceeded"...why?
lists at cheimes.de
Wed Feb 18 03:08:58 CET 2009
Thomas Allen wrote:
> If you'd read the messages in this thread you'd understand why I'm not
> using os.walk(): I'm not using it because I need my code to be aware
> of the current recursion depth so that the correct number of "../" are
> substituted in.
I'm well aware of your messages and your requirements. However you
didn't either read or understand what I was trying to tell you. You
don't need to know the recursion depths in order to find the correct
number of "../".
base = os.path.normpath(base)
baselevel = root.count(os.sep)
for root, dirs, files in os.walk(base):
level = root.count(os.sep) - baselevel
offset = level * "../"
More information about the Python-list