question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'width' line 54, in inkscape_convert_svg2png

See original GitHub issue

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!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jasil2215Pcommented, Aug 2, 2022

Thank you everyone for helping me out 😃

0reactions
heyzeccommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python KeyError Exceptions and How to Handle Them
In this tutorial, you'll learn how to handle Python KeyError exceptions. ... The second-to-last line tells you which line raised the exception.
Read more >
I'm getting Key error in python - Stack Overflow
A KeyError generally means the key doesn't exist. So, are you sure the path key exists? From the official python docs: exception KeyError....
Read more >
How to Fix KeyError Exceptions in Python - Rollbar
The Python KeyError is an exception that occurs when an attempt is made to access an item in a dictionary that does not...
Read more >
What is KeyError in Python? Dictionary and Handling Them
This article will provide you with a detailed and comprehensive knowledge of how to resolve KeyError in Python in Dictionary.
Read more >
youcompleteme key error when using vim
I'm using vim on Ubuntu 16.04 with the official vim-youcompleteme package. There are questions with the same problem on stackoverflow here and here, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found