"Maximum recursion depth exceeded"...why?

"Martin v. Löwis" martin at v.loewis.de
Tue Feb 17 23:05:42 CET 2009

Thomas Allen wrote:
> I must not be understanding something. This is a simple recursive
> function that prints all HTML files in argv[1] as its scans the
> directory's contents. Why do I get a RuntimeError for recursion depth
> exceeded?
> def main():
>     absToRel(sys.argv[1], sys.argv[2])
> def absToRel(dir, root):
>     for filename in os.listdir(dir):
>         if os.path.isdir(filename):

Perhaps you have a symlink somewhere that makes the tree appear to
have infinite depth?


More information about the Python-list mailing list