Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

KeyError: 'width' line 54, in inkscape_convert_svg2png #76

Closed
jasil2215P opened this issue Jul 21, 2022 · 5 comments
Closed

KeyError: 'width' line 54, in inkscape_convert_svg2png #76

jasil2215P opened this issue Jul 21, 2022 · 5 comments

Comments

@jasil2215P
Copy link

Hi,
I am facing an error like this:

Traceback (most recent call last):
  File "./matter.py", line 876, in <module>
    do_install()
  File "./matter.py", line 543, in do_install
    prepare_source_dir()
  File "./matter.py", line 386, in prepare_source_dir
    convert_icon_svg2png(icon)
  File "./matter.py", line 248, in convert_icon_svg2png
    exit_code = converter(color, src_path, dst_path, whisper=whisper)
  File "/home/jaza/Documents/Hacking/matter/svg2png.py", line 54, in inkscape_convert_svg2png
    int_ignore_units(root.attrib["width"]),
KeyError: 'width'

And here is the command I run:
sudo ./matter.py -i ubuntu folder _ _ _ _ _ _ microsoft-windows
I am just trying to change my GRUB theme using matter and I think all the dependency have been installed properly.

Thank you for your advice and solutions!

@heyzec
Copy link
Collaborator

heyzec commented Jul 21, 2022

Which Linux distribution are you using, and what version is your inkscape?

@jasil2215P
Copy link
Author

jasil2215P commented Jul 21, 2022

I am using Ubuntu 18.04

inkscape --version
Inkscape 0.92.3 (2405546, 2018-03-11)

And both grub-mkconfig and grub-mkfont are installed:

grub-mkconfig (GRUB) 2.02-2ubuntu8.23
jaza@ubuntu:~$ grub-mkfont --version
grub-mkfont (GRUB) 2.02-2ubuntu8.23

@jasil2215P
Copy link
Author

jaza@ubuntu:~/Documents/Hacking/matter$ sudo ./matter.py -i ubuntu folder _ _ _ _ _ _ microsoft-windows
[I] Begin Matter install
[I] Build theme from user preferences
[I] Convert icons
Traceback (most recent call last):
  File "./matter.py", line 876, in <module>
    do_install()
  File "./matter.py", line 543, in do_install
    prepare_source_dir()
  File "./matter.py", line 386, in prepare_source_dir
    convert_icon_svg2png(icon)
  File "./matter.py", line 248, in convert_icon_svg2png
    exit_code = converter(color, src_path, dst_path, whisper=whisper)
  File "/home/jaza/Documents/Hacking/matter/svg2png.py", line 54, in inkscape_convert_svg2png
    int_ignore_units(root.attrib["width"]),
KeyError: 'width'

This is the complete output

@heyzec
Copy link
Collaborator

heyzec commented Jul 23, 2022

I finally managed to reproduce it. It seems like the site where the icons are downloaded from have changed the format of their SVGs.

It used to be

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="mdi-ubuntu" width="24" height="24" viewBox="0 0 24 24"><path ... />
</svg>

Now it is

<svg xmlns="http://www.w3.org/2000/svg" id="mdi-ubuntu" viewBox="0 0 24 24"><path ... />
</svg>

The width and height attributes have been removed. We need to calculate them from the viewBox property instead.

heyzec added a commit to heyzec/matter that referenced this issue Jul 23, 2022
mateosss pushed a commit that referenced this issue Jul 25, 2022
@jasil2215P
Copy link
Author

Thank you everyone for helping me out :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants