NoneType Error-Messages

Hi all,

I was trying a lot, but I very often get a error-message while using some scripts. I dont know why, I’m not a coder… Maybe some one can explain.


while using mekkablues script “delete all non masters”

(https://github.com/mekkablue/Glyphs-Scripts/blob/master/Masters/Delete%20all%20non-M aster%20layers.py)


the error-message this:

Start
Traceback (most recent call last):
File “Delete all non-Master layers.py”, line 31, in
File “Delete all non-Master layers.py”, line 19, in process
AttributeError: ‘NoneType’ object has no attribute 'find’
End


this is not the only script which isn’t working right.
Many other name the problem “NoneType”

My Glyphs Verison ist Version 1.4.4 (597)

thanks

Did you have a font open?
If so, can you send me the font to res at this domain, please?

I can image the reason:

one layer is empty (there are no notes) and the script stops, and ignore the rest of the layers after the empty one …

i cant fix this fast, but i could try to improve my code-skills with this problem :slight_smile:

I have the same problem regarding deleting glyphs (my own code). I am deleting glyphs that have a specific graphic (let’s say notdef outline), but it stops at certain point, giving this error, while there are many left.

If I ignore it and run many times, eventually I can delete all of them, so it seems that there’s no problem with specific glyphs.

I tried to fix it as good as I can with my skills.
works now also for empty layers. (But im not sure wether there are dangerous exceptions in the system …)

I add a new Suggestion on mekkablues ‘delete all non-master.py’ on Github. But there are still some error-messages.

There are layers without a name in the font. I didn’t know this was possible. Thanks for the input, I will adjust the script.

The error message means that you are trying to run a function on an object which, for some reason, is None. In the case of the script mentioned above, the script first looked at the name of the layer and tried to find “[” and “]” in it, but an unnamed layer’s name is None, but the find() function only works on objects of the type string not of type None. And that was the error message you got.

I just uploaded a bug fixed version to GitHub.

Nevu, can you tell me which scripts do not work for you? Preferably with an issue on GitHub. Thanks in advance.

Ok,

thanks again for support.

I will collect all suspicious scripts an tell you.