scour-project / scour

Scour - An SVG Optimizer / Cleaner
Apache License 2.0
757 stars 61 forks source link

Expecting a nonnegative number in path #279

Open IceflowRE opened 3 years ago

IceflowRE commented 3 years ago

Iam not sure if Inkscape creates invalid svgs or what exactly happened.

<svg version="1.1" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#"
     xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <path id="path958-2-7-5-5-7-5-9-3" style="color:#000000;fill:#ffffff;stroke-linecap:round" d="m 752,472 a -40,40 0 0 1 40,40 -40,40 0 0 1 -40,40 h -26.94922 a -120,120 0 0 0 6.9492,-40 -120,120 0 0 0 -6.9492,-40 z m -253.12502,0 a -120,120 0 0 0 -6.875,40 -120,120 0 0 0 6.9492,40 h -226.9492 a -40,40 0 0 1 -40,-40 -40,40 0 0 1 40,-40 z"/>
</svg>

log

  File "symbconv\export.py", line 32, in optimize_svg
    scour.start(options, in_file, out_file)
  File "scour\scour.py", line 4152, in start
    out_string = scourString(in_string, options, stats=stats).encode("UTF-8")
  File "scour\scour.py", line 3805, in scourString
    clean_path(elem, options, stats)
  File "scour\scour.py", line 2282, in clean_path
    path = svg_parser.parse(oldPathStr)
  File "scour\svg_regex.py", line 160, in parse
    return self.rule_svg_path(next_val_fn, token)
  File "scour\svg_regex.py", line 168, in rule_svg_path
    command_group, token = rule(next_val_fn, token)
  File "scour\svg_regex.py", line 235, in rule_elliptical_arc
    raise SyntaxError("expecting a nonnegative number; got %r" % (token,))
SyntaxError: expecting a nonnegative number; got ('float', '-40')

Version: 897e3f565c13fb27b1c19ece860269f3ba70e9fd