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

TypeError: ufunc 'degrees' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe' #187

Open
yaqwsx opened this issue Sep 22, 2022 · 0 comments

Comments

@yaqwsx
Copy link

yaqwsx commented Sep 22, 2022

Hi, when I try to extract path using this piece of code:

paths = svgpathtools.document.flattened_paths(xmlParse(svgString))

I get the following error for the document attached below:

File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/document.py", line 148, in flattened_paths
    path = transform(parse_path(converter(path_elem)), path_tf)
  File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/path.py", line 312, in transform
    return transform_segments_together(curve, transformation)
  File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/path.py", line 191, in transform_segments_together
    transformed_segs = [transformation(seg) for seg in path]
  File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/path.py", line 191, in <listcomp>
    transformed_segs = [transformation(seg) for seg in path]
  File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/path.py", line 311, in <lambda>
    transformation = lambda seg: transform(seg, tf)
  File "/home/xmrazek7/.local/lib/python3.8/site-packages/svgpathtools/path.py", line 338, in transform
    rot = np.degrees(np.arccos(xeigvec[0]))
TypeError: ufunc 'degrees' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

The error is caused by the fact that np.arccos is evaluated to a complex number: (1.5707963267948966+0.3850858480697339j)

test
test.zip

@yaqwsx yaqwsx changed the title ypeError: ufunc 'degrees' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe' TypeError: ufunc 'degrees' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe' Sep 25, 2022
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