[Tutor] Complaint about maximum recursion

Kristoffer Erlandsson krier115 at student.liu.se
Wed Oct 1 01:47:32 EDT 2003


On Tue, Sep 30, 2003 at 11:41:36PM +0100, Jonathan Hayward http://JonathansCorner.com wrote:
[snip]
> line 772, in get_tag_contents_internal
>    return my_re.findall(file_contents)
> RuntimeError: maximum recursion limit exceeded

The problem here is that regular expressions with non-greedy qualifiers
(*? etc) are implemented using recursion. Either try rewriting them to
greedy ones, or if you are sure you are just exceeding the limit by a
small amount you can use sys.setrecursionlimit(n) to increase the limit.
sys.getrecursionlimit() shows you the current limit. 1000 by default on
my system.

Hope this helps a bit :)

Regards,

-- 
Kristoffer Erlandsson                               http://errl.info



More information about the Tutor mailing list