svgelements icon indicating copy to clipboard operation
svgelements copied to clipboard

write_xml method doesn't accept pathlib.Path input

Open suedunham opened this issue 2 years ago • 1 comments

When using the SVG.write_xml() method, I cannot simply hand it a pathlib.Path() object for the new filename. Instead, an exception is raised.

File "C:\Python311\Lib\site-packages\svgelements\svgelements.py", line 3429, in write_xml
    write(self, f)
  File "C:\Python311\Lib\site-packages\svgelements\svgelements.py", line 9362, in write
    if f.lower().endswith("svgz"):
       ^^^^^^^
AttributeError: 'WindowsPath' object has no attribute 'lower'. Did you mean: 'owner'?

This isn't a huge issue, since I can just do something like svg.write_xml(str(file_path)). However, the SVG.parse() method does work with Path() objects as input, and it would be nice if the other did as well for uniformity's sake.

suedunham avatar May 06 '23 17:05 suedunham

Should be fixed in the 1.9.4

tatarize avatar May 14 '23 03:05 tatarize