为什么svg.path的长度函数返回除零错误?

时间:2015-09-16 14:41:47

标签: python python-2.7 svg divide-by-zero

我正在使用python来分析svg图像文件,我试图告诉路径的长度。我有路径

M 160.0000 219.2500 L 160.0000 218.6250 Q 160.0000 218.0000 160.0000
217.3750 Q 160.0000 216.7500 159.3750 216.7500 Q 158.7500 216.7500 158.7500
216.1250 Q 158.7500 215.5000 158.7500 217.3750 Q 158.7500 219.2500 159.3750
221.1250 Q 160.0000 223.0000 160.6250 224.8750 Q 161.2500 226.7500 161.8750
228.0000 Q 162.5000 229.2500 163.1250 229.8750 Q 163.7500 230.5000 163.7500
231.1250 Q 163.7500 231.7500 163.1250 230.5000 Q 162.5000 229.2500 160.6250
226.7500 Q 158.7500 224.2500 156.8750 220.5000 Q 155.0000 216.7500 153.7500
214.8750 Q 152.5000 213.0000 151.8750 211.1250 Q 151.2500 209.2500 150.6250
208.6250 Q 150.0000 208.0000 149.3750 206.7500 Q 148.7500 205.5000 149.3750
206.7500 Q 150.0000 208.0000 152.5000 211.1250 Q 155.0000 214.2500 156.8750
217.3750 Q 158.7500 220.5000 160.6250 223.6250 Q 162.5000 226.7500 163.1250
228.6250 Q 163.7500 230.5000 164.3750 231.1250 Q 165.0000 231.7500 165.6250
232.3750 Q 166.2500 233.0000 165.0000 231.1250 Q 163.7500 229.2500 162.5000 
...

我使用这些线将它强制转换为路径对象,但是当我尝试打印长度时,它会给出除以零的错误。

path = svg.path.parse_path(str(PATH_VARIABLE)
print path.length()

0 个答案:

没有答案