From: Dave P. <dav...@gm...> - 2014-11-16 12:11:08
|
20K line file, final error reported is File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", line 54, in build_correct if current['level'] > prev_element['level']: RuntimeError: maximum recursion depth exceeded in cmp Any idea what I should be chasing please, in the md file? regards -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk |
From: Waylan L. <way...@ic...> - 2014-11-16 13:34:34
|
The error seems pretty self-explanatory to me. You are getting a recursion error in the `build_correct` method of the TOC Extension. A quick look at the source indicates that that method recursively calls itself to turn a flat list of headers (h1-6) taken from the document and rearranges them into a properly nested list to use as the Table of Contents. The short answer would be to not use that extension with such a long document. But, the correct answer I suppose would be to refactor the `build_correct` method to not be recursive - which may be easier said that done. Waylan Limberg > On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: > > 20K line file, > > final error reported is > File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", > line 54, in build_correct > if current['level'] > prev_element['level']: > RuntimeError: maximum recursion depth exceeded in cmp > > > Any idea what I should be chasing please, in the md file? > > regards > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |
From: Dave P. <dav...@gm...> - 2014-11-16 14:03:22
|
Yes, that worked. 25K lines, no toc, builds the html. I can work with that. Thanks. Dave P On 16 November 2014 13:34, Waylan Limberg <way...@ic...> wrote: > The error seems pretty self-explanatory to me. You are getting a recursion error in the `build_correct` method of the TOC Extension. A quick look at the source indicates that that method recursively calls itself to turn a flat list of headers (h1-6) taken from the document and rearranges them into a properly nested list to use as the Table of Contents. > > The short answer would be to not use that extension with such a long document. But, the correct answer I suppose would be to refactor the `build_correct` method to not be recursive - which may be easier said that done. > > Waylan Limberg > >> On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: >> >> 20K line file, >> >> final error reported is >> File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", >> line 54, in build_correct >> if current['level'] > prev_element['level']: >> RuntimeError: maximum recursion depth exceeded in cmp >> >> >> Any idea what I should be chasing please, in the md file? >> >> regards >> -- >> Dave Pawson >> XSLT XSL-FO FAQ. >> Docbook FAQ. >> http://www.dpawson.co.uk >> >> ------------------------------------------------------------------------------ >> Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk >> _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk |
From: Waylan L. <way...@ic...> - 2014-11-17 01:58:45
|
Dave, I'm glad you were able to make that work for you. For the record, I've created a bug report for this here: https://github.com/waylan/Python-Markdown/issues/366 Waylan -----Original Message----- From: Dave Pawson [mailto:dav...@gm...] Sent: Sunday, November 16, 2014 9:03 AM To: Waylan Limberg Cc: PythonMD list Subject: Re: [Python-markdown-discuss] recursion error? Yes, that worked. 25K lines, no toc, builds the html. I can work with that. Thanks. Dave P On 16 November 2014 13:34, Waylan Limberg <way...@ic...> wrote: > The error seems pretty self-explanatory to me. You are getting a recursion error in the `build_correct` method of the TOC Extension. A quick look at the source indicates that that method recursively calls itself to turn a flat list of headers (h1-6) taken from the document and rearranges them into a properly nested list to use as the Table of Contents. > > The short answer would be to not use that extension with such a long document. But, the correct answer I suppose would be to refactor the `build_correct` method to not be recursive - which may be easier said that done. > > Waylan Limberg > >> On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: >> >> 20K line file, >> >> final error reported is >> File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", >> line 54, in build_correct >> if current['level'] > prev_element['level']: >> RuntimeError: maximum recursion depth exceeded in cmp >> >> >> Any idea what I should be chasing please, in the md file? >> >> regards >> -- >> Dave Pawson >> XSLT XSL-FO FAQ. >> Docbook FAQ. >> http://www.dpawson.co.uk >> >> --------------------------------------------------------------------- >> --------- Comprehensive Server Monitoring with Site24x7. >> Monitor 10 servers for $9/Month. >> Get alerted through email, SMS, voice calls or mobile push notifications. >> Take corrective actions from your mobile device. >> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg >> .clktrk _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk ---------------------------------------------------------------------------- -- Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ Python-markdown-discuss mailing list Pyt...@li... https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |
From: Dave P. <dav...@gm...> - 2014-11-17 07:57:58
|
On 17 November 2014 01:58, Waylan Limberg <way...@ic...> wrote: > Dave, > > I'm glad you were able to make that work for you. For the record, I've > created a bug report for this here: > https://github.com/waylan/Python-Markdown/issues/366 Thanks. From memory there were 28000 entries, set to ## or ### for the toc to process. I had to cut it into 7 parts, to roughly 4000 entries is about the max depth? Seems recursion is the right idea, just that it needs to be clean tail recursion. Thanks. DaveP > > Waylan > > -----Original Message----- > From: Dave Pawson [mailto:dav...@gm...] > Sent: Sunday, November 16, 2014 9:03 AM > To: Waylan Limberg > Cc: PythonMD list > Subject: Re: [Python-markdown-discuss] recursion error? > > Yes, that worked. 25K lines, no toc, builds the html. > I can work with that. > > Thanks. Dave P > > On 16 November 2014 13:34, Waylan Limberg <way...@ic...> wrote: >> The error seems pretty self-explanatory to me. You are getting a recursion > error in the `build_correct` method of the TOC Extension. A quick look at > the source indicates that that method recursively calls itself to turn a > flat list of headers (h1-6) taken from the document and rearranges them into > a properly nested list to use as the Table of Contents. >> >> The short answer would be to not use that extension with such a long > document. But, the correct answer I suppose would be to refactor the > `build_correct` method to not be recursive - which may be easier said that > done. >> >> Waylan Limberg >> >>> On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: >>> >>> 20K line file, >>> >>> final error reported is >>> File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", >>> line 54, in build_correct >>> if current['level'] > prev_element['level']: >>> RuntimeError: maximum recursion depth exceeded in cmp >>> >>> >>> Any idea what I should be chasing please, in the md file? >>> >>> regards >>> -- >>> Dave Pawson >>> XSLT XSL-FO FAQ. >>> Docbook FAQ. >>> http://www.dpawson.co.uk >>> >>> --------------------------------------------------------------------- >>> --------- Comprehensive Server Monitoring with Site24x7. >>> Monitor 10 servers for $9/Month. >>> Get alerted through email, SMS, voice calls or mobile push notifications. >>> Take corrective actions from your mobile device. >>> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg >>> .clktrk _______________________________________________ >>> Python-markdown-discuss mailing list >>> Pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ---------------------------------------------------------------------------- > -- > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk |
From: Dave P. <dav...@gm...> - 2014-11-17 13:42:15
|
Thinking more practically. A TOC of 28000 entries is rather silly and quite impractical. Perhaps more useful would be a parameter to request TOC at level n only, e.g. (my case) h2/## entries. Reduction in processing and less pain for the reader. regards On 17 November 2014 01:58, Waylan Limberg <way...@ic...> wrote: > Dave, > > I'm glad you were able to make that work for you. For the record, I've > created a bug report for this here: > https://github.com/waylan/Python-Markdown/issues/366 > > Waylan > > -----Original Message----- > From: Dave Pawson [mailto:dav...@gm...] > Sent: Sunday, November 16, 2014 9:03 AM > To: Waylan Limberg > Cc: PythonMD list > Subject: Re: [Python-markdown-discuss] recursion error? > > Yes, that worked. 25K lines, no toc, builds the html. > I can work with that. > > Thanks. Dave P > > On 16 November 2014 13:34, Waylan Limberg <way...@ic...> wrote: >> The error seems pretty self-explanatory to me. You are getting a recursion > error in the `build_correct` method of the TOC Extension. A quick look at > the source indicates that that method recursively calls itself to turn a > flat list of headers (h1-6) taken from the document and rearranges them into > a properly nested list to use as the Table of Contents. >> >> The short answer would be to not use that extension with such a long > document. But, the correct answer I suppose would be to refactor the > `build_correct` method to not be recursive - which may be easier said that > done. >> >> Waylan Limberg >> >>> On Nov 16, 2014, at 7:11 AM, Dave Pawson <dav...@gm...> wrote: >>> >>> 20K line file, >>> >>> final error reported is >>> File "/usr/lib/python2.7/site-packages/markdown/extensions/toc.py", >>> line 54, in build_correct >>> if current['level'] > prev_element['level']: >>> RuntimeError: maximum recursion depth exceeded in cmp >>> >>> >>> Any idea what I should be chasing please, in the md file? >>> >>> regards >>> -- >>> Dave Pawson >>> XSLT XSL-FO FAQ. >>> Docbook FAQ. >>> http://www.dpawson.co.uk >>> >>> --------------------------------------------------------------------- >>> --------- Comprehensive Server Monitoring with Site24x7. >>> Monitor 10 servers for $9/Month. >>> Get alerted through email, SMS, voice calls or mobile push notifications. >>> Take corrective actions from your mobile device. >>> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg >>> .clktrk _______________________________________________ >>> Python-markdown-discuss mailing list >>> Pyt...@li... >>> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ. > http://www.dpawson.co.uk > > ---------------------------------------------------------------------------- > -- > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. http://www.dpawson.co.uk |