"Maximum recursion depth exceeded"...why?

"Martin v. Löwis" martin at v.loewis.de
Tue Feb 17 17:05:42 EST 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?

Regards,
Martin



More information about the Python-list mailing list