Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecursionError: maximum recursion depth exceeded #310

Open
kno10 opened this issue Mar 9, 2023 · 0 comments
Open

RecursionError: maximum recursion depth exceeded #310

kno10 opened this issue Mar 9, 2023 · 0 comments

Comments

@kno10
Copy link

kno10 commented Mar 9, 2023

This SVG image crashes scour with a recursion depth error (debian package version 0.38.2):
test

Traceback (most recent call last):
  File "/usr/bin/scour", line 33, in <module>
    sys.exit(load_entry_point('scour==0.38.2', 'console_scripts', 'scour')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 4220, in run
    start(options, input, output)
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 4188, in start
    out_string = scourString(in_string, options).encode("UTF-8")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 3761, in scourString
    _num_style_properties_fixed = repairStyle(doc.documentElement, options)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1815, in repairStyle
    num += repairStyle(child, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1815, in repairStyle
    num += repairStyle(child, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1815, in repairStyle
    num += repairStyle(child, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 494 more times]
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1725, in repairStyle
    if styleInheritedFromParent(node, 'stroke') in [None, 'none']:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1846, in styleInheritedFromParent
    return styleInheritedFromParent(parentNode, style)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1846, in styleInheritedFromParent
    return styleInheritedFromParent(parentNode, style)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1846, in styleInheritedFromParent
    return styleInheritedFromParent(parentNode, style)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 493 more times]
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1834, in styleInheritedFromParent
    styles = _getStyle(parentNode)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/scour/scour.py", line 1663, in _getStyle
    style_attribute = node.getAttribute('style')
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded

The image was generated with matplotlib, then converted to SVG with inkscape. It seems that inkscape managed to stack 500 <g> elements in one another... it does not happen with pdfcairo, nor pdf2svg, nor inkscape --pdf-poppler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant