meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
124 stars 28 forks source link

write_xml method doesn't accept pathlib.Path input #227

Open suedunham opened 1 year ago

suedunham commented 1 year ago

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.

tatarize commented 1 year ago

Should be fixed in the 1.9.4