[Tutor] tree problem

Lie Ryan lie.1296 at gmail.com
Sun Sep 12 13:54:12 CEST 2010

On 09/12/10 21:15, Roelof Wobben wrote:
> Hello, 
> I have this problem.
> Write a program named litter.py that creates an empty file named trash.txt in each subdirectory of a directory tree given the root of the tree as an argument (or the current directory as a default). 

By default, Python has a recursion limit of 1000 deep; that is, your
function is calling itself 1000 times without returning.

In this case, the only reason why you hit the recursion limit is if you
have a directory which is 1000 deep (quite unlikely, Windows has a
directory depth limit much lower than that).

Or your function somehow never returns, in a typical recursive function,
it's usually because you have problem in the precondition.

More information about the Tutor mailing list