Skip to content

Ploting fails. get_axes(lines, width, height) produces an error. #3

@wobbuuu

Description

@wobbuuu

Hi!
I found your utility here and feel like it may be very useful for me. I try to use it as manual says but got an error:

from svg2data import svg2data
data = svg2data("/data/test.svg")

Produces:

ValueError                                Traceback (most recent call last)
<ipython-input-2-15f3cf48a742> in <module>
----> 1 data = svg2data("/data/test.svg")
      2 data.writesvg('/data/newfile.svg')

~/Downloads/svg2data-master/svg2data.py in __init__(self, filename, test, debug)
     38             self._tree = ET.parse(filename)
     39             root = self._tree.getroot()
---> 40             width = float(root.attrib['width'])
     41             height = float(root.attrib['height'])
     42 

ValueError: could not convert string to float: '210mm'

when I changed sources to:

width = float(root.attrib['width'][:-2])
height = float(root.attrib['height'][:-2])

I was able to read and write svg file in the debug mode debug='get_axes', but I can't figure out how to fix other parts of the code which are responsible for plotting.

Is it a problem of my sample svg file or not? Could you help me to fix this issue?

Thanks,
Anton

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions